Wish you & your family very happy & prosperous new year 2013.
Category: Archive
Engineering notes from 2008–2014: SQL Server scripts, DBA quick-tips, and field notes from the trenches. Preserved as written — the foundation everything since was built on.
-
Powershell Script to get the Operating System Infomrmation
You can use the Win32_OperatingSystem class to get the Operating system info.
$hostname = "Enter Computer Name" Get-WmiObject -class win32_operatingsystem -computer $hostname | select-object *
-
Script to check – Login Name and Password are same
It is always a risk if the user name & password is equal. You can run the below script to find out the list of User/Login name & password which are equal.
select cast(@@SERVERNAME as varchar(150)) as SQLInstanceName ,name as [LoginName] ,'Password is same as Login Name' [Description] from sys.syslogins WHERE PWDCOMPARE (name,password) = 1
-
Lock Windows/Desktop with a Single Keystroke
You can lock the windows/desktop using single keystroke “Windows” + “L”, instead of CTRL + ALT + DEL + ENTER
-
Powershell Script to get total and free disk space
You can execute the below powershell script to get total & free disk space which includes the mount drive as well.
Get-WmiObject -class Win32_volume -filter "drivetype = 3" | select name, @{Name="Capacity";Expression={$_.capacity / 1GB}},@{Name="freespace";Expression ={$_.freespace / 1GB}}


