• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1114
  • Last Modified:

Powershell script to print computers and os version within domain

I need a Powershell script to print a list of all computers and their os versions within domain.
0
roosterup
Asked:
roosterup
1 Solution
 
Sarang TinguriaSr EngineerCommented:
I am not sure about Powershell however Chris has a great GUI tool for all theese stuffs

Cjwdev | AD Info - Active Directory Reporting www.cjwdev.co.uk/Software/ADReportingTool/Info.html

Or

AdFind by joe but CLI
www.joeware.net/freetools/tools/adfind/index.htm
0
 
SubsunCommented:
Check this blog post for getting the list using Microsoft AD cmdlets..
http://blogs.technet.com/b/askds/archive/2010/02/04/inventorying-computers-with-ad-powershell.aspx

With Quest AD cmdlets use the following code..
Get-QADComputer -SizeLimit 0 | Select-Object Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion | Export-CSV AllWindows.csv -NoTypeInformation

Open in new window

0
 
traoherCommented:
$ou = [ADSI]"LDAP://OU=<OU>,DC=<domain>,DC=<COM>"
foreach ($Server in $ou.psbase.Children)
{
      if ($Server.ObjectCategory -like '*computer*')
      {
            $Server = $Server.Name
            $query = "select * from win32_pingstatus where address = '$Server'"
            $result = Get-WmiObject -query $query -ErrorAction SilentlyContinue
            #$result | fl
            if ($result.ProtocolAddress)
            {
                  $Win32_OS = Get-WmiObject Win32_OperatingSystem -computer $Server -ErrorAction SilentlyContinue | select Caption,servicepackmajorversion
                  if($Win32_OS.caption -like '*Microsoft*'){
                  "$Server `t `t -$($Win32_OS.Caption) Service Pack $($Win32_OS.servicepackmajorversion)"
                  Get-WMIObject -class Win32_Printer -computer $Server | Select Name,DriverName,PortName
                  } else {"$Server  `t `t -is NOT a Windows Host"}
             }
       else
       {
             "$Server  `t `t -is OFFLINE"
       }
       }
}
0

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now