Search 64 bit and 32 bit systems seperately in AD using query

vijaygotur
vijaygotur used Ask the Experts™
on
Hi,

I require a dsquery or PowerShell command to search Window 7 64bit and 32 bit systems separately in Windows Active directory.

Please help me.

Thanks,
Vijay
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Create a file called profile.ps1 in the C:\Windows\System32\WindowsPowerShell\v1.0 folder,
copy the below contents to this  profile.ps1

function Get-OSArchitecture {
[cmdletbinding()]
param(
    [parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
    [string[]]$ComputerName = $env:computername
)            

begin {}            

process {            

 foreach ($Computer in $ComputerName) {
  if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
   Write-Verbose "$Computer is online"
   $OS  = (Get-WmiObject -computername $computer -class Win32_OperatingSystem ).Caption
   if ((Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer -ea 0).OSArchitecture -eq '64-bit') {
    $architecture = "64-Bit"
   } else  {
    $architecture = "32-Bit"
   }            

   $OutputObj  = New-Object -Type PSObject
   $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
   $OutputObj | Add-Member -MemberType NoteProperty -Name Architecture -Value $architecture
   $OutputObj | Add-Member -MemberType NoteProperty -Name OperatingSystem -Value $OS
   $OutputObj
  }
 }
}            

end {}            

}


then run the below command,

Get-OSArchitecture -ComputerName PC1, PC2, PC3 | ft -auto

you will find the system is 32 or 64 bit

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial