Server Management

Get All installed programs on server

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize >C:\temp\installed.txt 

Script to get all installed KB numbers from Windows Update

$wu = new-object -com “Microsoft.Update.Searcher”
$totalupdates = $wu.GetTotalHistoryCount()
$all = $wu.QueryHistory(0,$totalupdates)
$OutputCollection= @()
Foreach ($update in $all)
$string = $update.title
$Regex = “KB\d*”
$KB = $string | Select-String -Pattern $regex | Select-Object {$_.Matches }
$output = New-Object -TypeName PSobject
$output | add-member NoteProperty “HotFixID” -value $KB.‘ $_.Matches ‘.Value
$output | add-member NoteProperty “Title” -value $string
$OutputCollection += $output
$OutputCollection | Sort-Object HotFixID | Format-Table -AutoSize
Write-Host “$($OutputCollection.Count) Updates Found” 

Working with the Filesystem

Command What it does
Get-Childitem -Path C:\windows -Recurse -Filter *.dll Find all DLL in Windows filesystem C:\Windows (Edit as you need)
Get-ChildItem -path D:\home\ -Recurse -Filter *mp3* | Export-Csv select * Find any file tagged as MP3 im the Home Filesystem. (Edit as you need)
Get-ItemProperty | select * Gets details information on file X