Răzvan Cosma's scratchpad

random scripts of random value

Browsing Posts in Windows

%windir%\Downloaded Program Files\TransferMgr.exe

Purpose: allow a specific user to backup and restore database, without giving her full access to the filesystem. As dbo, create the proc below, create the login, grant public access to master, grant dbo access on the needed databases, grant execute on dbo.backupng and dbo.restoreng to sqluser. As user, exec backupng @database=’somename’

Either Tools->Folder Options->View-> uncheck Use simple file sharing or Hive: HKEY_CURRENT_USER Key: Software\Microsoft\windows\CurrentVersion\Policies\Explorer Name: Nosecuritytab Type: REG_DWORD Value: 0 or convert c: /fs:ntfs

EXEC sp_help_revlogin

regsvr32 /n /i:U shell32

DECLARE @db nvarchar(50) set @db=’my.datab.name’ –close all connections DECLARE @SPId int DECLARE @CMD varchar(100) DECLARE my_cursor CURSOR FAST_FORWARD FOR SELECT SPId FROM MASTER..SysProcesses WHERE DBId = DB_ID(@db) AND SPId <> @@SPId OPEN my_cursor FETCH NEXT FROM my_cursor INTO @SPId WHILE @@FETCH_STATUS = 0 BEGIN SELECT @CMD = ‘KILL ‘ + CAST(@SPId AS varchar(10)) EXEC (@CMD) […]

1. %windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -u 2. %windir%\system32\cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1 3. %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i 4. Enable the 32-bit ASP.net extension from IIS Manager

Connect to the source -> Tasks -> Generate Scripts -> check “Script all objects” -> Script Database Create = true -> Script for Server Version = 200x -> Script Logins = false -> Script Data = true -> Script anything else needed (constraints, fulltext, etc) -> Finish -> change the path for CREATE DATABASE if […]

There is no ready-made class, so you’ll have to call the Windows API [DllImport(“KERNEL32.DLL”, EntryPoint = “GetPrivateProfileStringW”, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] private static extern int GetPrivateProfileString( string lpAppName, string lpKeyName, string lpDefault, string lpReturnString, int nSize, string lpFilename); [DllImport(“KERNEL32.DLL”, EntryPoint = “WritePrivateProfileStringW”, SetLastError = true, CharSet = […]

Option 1: srvany and instsrv from the Windows Resource Kit Option 2: Start->Run->MMC->Add snap-in->Group policy->Local computer->Computer configuration->Windows settings->Scripts The applications will run as Local System

Bad Behavior has blocked 69 access attempts in the last 7 days.