Powershell Snippets

List local user accounts Get-WmiObject -Class Win32_UserAccount -Filter “LocalAccount=’True'” List local user accounts and parse array $local_users = Get-WmiObject -Class Win32_UserAccount -Filter “LocalAccount=’True'” | findstr “Caption”; for ($i = 0; $i -lt $local_users.Count; $i++) {     Write-Host $local_users[$i].split(“\\”)[1]; } List all installed Windows updates Get-Hotfix-computername <hostname>| Select HotfixID, InstalledOn |Sort-Object InstalledOn Output will look something … Continue reading Powershell Snippets