Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, August 16, 2013 5:03 AM
Hi Everyone,
I'm trying to create a script that pulls remote computer names from a OU and then takes those computer names and uses them to pull Hard Drive serial numbers for those computers. Below is what I have come up with but every time I run the script I get RPC unavailable error. Its not the RPC because if I manually do one computer name at a time using the attached script, I can pull the serial number. But if try to run using the array variable...the RPC error shows up. Looking for some help please.
Brandon
Import-Module ActiveDirectory
$list=Get-ADComputer -SearchBase "OU=Workstations,OU=Testing,OU=GCE,DC=lnk,DC=tgf,DC=link,DC=com" -Filter {Description -Like "*MASS-1*"} -Properties Description | Select Name
$serials=Get-WmiObject win32_diskDrive -ComputerName $list | select SerialNumber
write-host $serials
All replies (3)
Friday, August 16, 2013 5:24 AM âś…Answered
Try
Foreach ($l in $list){
$serials=Get-WmiObject win32_diskDrive -ComputerName $l.name | select SerialNumber
write-host $serials
}
Friday, August 16, 2013 5:26 AM
Import-Module ActiveDirectory
$lists=Get-ADComputer -SearchBase "OU=Workstations,OU=Testing,OU=GCE,DC=lnk,DC=tgf,DC=link,DC=com" -Filter {Description -Like "*MASS-1*"} -Properties Description | Select Name
foreach { ($list in $lists) {
Get-WmiObject win32_diskDrive -ComputerName $list | select SerialNumber
}
Thanks Azam When you see answers please Mark as Answer if Helpful..vote as helpful.
Friday, August 16, 2013 5:42 AM
This worked for me!! I really appreciate it! Thank You So Much!