This script use WMI to ping a list of computers. Only specific OS are pinged. Script (with Microsoft Active Directory module loaded : import-module activedirectory) : $ping = new-object System.Net.NetworkInformation.Ping $list = Get-ADComputer -LDAPFilter “(|(operatingsystem=Windows XP*)(operatingsystem=Windows 7*)(operatingsystem=Windows Vista*))” ForEach ($b
Get service pack level on Windows 2008 servers
WSUS server cleanup task
The best way to schedule an automatic cleanup of expired/superseeded update is to use the following Powershell script (source : http://www.peetersonline.nl/index.php/powershell/wsus-cleanup-with-powershell/) Script : #Region VARIABLES # WSUS Connection Parameters: [String]$updateServer = “myWSUSServer.domain.local” [Boolean]$useSecureConnection = $False [Int32]$portNumber = 80 # Cleanup
Monitor the Software registry hive size + send report by email
Get OS information using WMI
Fill a host file (hosts.txt) with the hostnames you want to retrieve OS information Script : $Catalog = GC “C:\hosts.Txt” ForEach($Machine in $Catalog) {$QueryString = Gwmi Win32_OperatingSystem -Comp $Machine $QueryString = $QueryString.Caption Write-Host $Machine “:” $QueryString} My Powershell script categories
Get operating system name information using Active Directory
Get installed software list on a specific computer
This script gets the installed software list on a specific computer using WMI Script : $strComputer = “computer_hostname” $colItems = get-wmiobject -class “Win32_Product” -namespace “root\CIMV2” ` -computername $strComputer foreach ($objItem in $colItems) { write-host “Caption: ” $objItem.Caption write-host “Description: “
Get hotfix list on remote host
This script gets the hotfix list installed on a remote system. I add a date filter to the result. Script : $strComputer = “remote_system_name” $hotfixlist = Get-HotFix -ComputerName $strComputer foreach ($hotfix in $hotfixlist) { if ($hotfix.psbase.properties[“installedOn”].Value -eq “10/28/2010”) { write-host