In Our company we have "Domain Environment" or we can say "Active Directory" is deployed. By using "Active Directory" lots of things gets easy to manage. The main things that Powershell works great with "Active Directory". To use Active Directory related CMDLETS on your client laptopt we need to install "RSAT" tool.
Problem: On some of our company laptop there are "Automatic Updates" are on, due to these auto updates Windows 7 Service Pack 1 is installed on those laptops, and Windows 7 SP1 is not compatible with some of our in-house developed software. So we need to identify these laptops.
Let's Start : Before doing anything make sure that "RSAT" tools are installed.
Import the Active Directory module first.
After importing the Module, we are going to use Get-ADComputer cmdlet.
To view all the computer on AD we can use the below cmdlet.
Get-ADComputer -Filter *
Lets filter it more . .. this time we want to see only those computers which have windows 7 installed.
Get-ADComputer -Filter 'OperatingSystem -eq "Windows 7 Professional"' | select Name
Ok. now it is showing all those computers which have windows 7 installed.. let filter it more.
As we know our main purpose is to find the "Windows 7 Computers with Service Pack 1" Installed.
Get-ADComputer -Filter '(OperatingSystem -eq "Windows 7 Professional") -and (OperatingSystemServicePack -eq "ServicePack1")'
So finally we have the list of all windows 7 computers with SP-1 installed on them.
Let just select Name Only.
Get-ADComputer -Filter '(OperatingSystem -eq "Windows 7 Professional") -and (OperatingSystemServicePack -eq "Service Pack 1")' | select Name
All sorted., Now i have the list of my all windows 7 computers which have Service Pack 1 installed on it.