Skip to content

Instantly share code, notes, and snippets.

@SweetAsNZ
Created February 7, 2022 03:08
Show Gist options
  • Save SweetAsNZ/00cb1695d060bcc856ef2889b324a6f5 to your computer and use it in GitHub Desktop.
Save SweetAsNZ/00cb1695d060bcc856ef2889b324a6f5 to your computer and use it in GitHub Desktop.
Get Servers and their OS
function Get-ServerOS{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$Server
)
Get-ADComputer -Filter {Name -eq $Server} -Properties Name,OperatingSystem,Enabled -ResultSetSize 1000000 |
Where-Object {$_.OperatingSystem -like "Windows Server*"} | Select-Object Name,Enabled,OperatingSystem |
Sort-Object Name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment