I need a script that will generate a user report with certain information

I'm trying to generate a report with the following information:

computer, username, Operating System, Architecture (i.e. 32-bit or 64-bit).

Can anyone help? I have managed to generate a user to machine report using:

:CHECK
echo Checking Connection ...
ping %1 -n 1  | findstr "TTL=" >nul && GOTO MAIN || GOTO ERROR
GOTO END

:ERROR
echo Device Unreachable
GOTO END

:MAIN

wmic /node: "%1" computersystem get username

GOTO END

:END


I put this in a batch file called who.bat and run who.bat 'computername'. But that only returns one computer at a time - which would take FORever. Any ideas? I'd
LVL 3
Roy BeneVP/Director - IT | ISOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

netcmhCommented:
You could try a different approach using powershell. Please see this page for step by step instructions and the script itself: http://www.signalwarrant.com/2013/09/18/computer-inventory-script-powershell/

More guidance and tweaks at http://markpashby.com/blog/?p=79

Another route is to use a login script to pull all the information, such as in http://www.lazysystemadmin.com/2010/06/login-script-inventory-collection-for.html
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
@ netcmh,

The script works fine until it should generate the pcinventory.csv file. In other words, it displays the progress bars and populates the live and dead pc text files. It also gets to the end and says it finishes. However, it does not create the final report. There is an error occurring somewhere. I noticed that the script is set to continue silently through errors. What can I set it to in order to see where the break is occurring? Thanks in advance for your help.
0
Steve KnightIT ConsultancyCommented:
Do you run a logon script for all users, you could simply add command to the end of that.
0
KuppingerCole Reviews AlgoSec in Executive Report

Leading analyst firm, KuppingerCole reviews AlgoSec's Security Policy Management Solution, and the security challenges faced by companies today in their Executive View report.

Roy BeneVP/Director - IT | ISOAuthor Commented:
Yes, but we do not have time to go through 3,000 text files. netcmh's solution is solid, I just need to figure out where the break is.
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
@ netcmh,

I do believe we figured it out. The script is at 44% now and collecting hardware info. I'll keep you 'posted' (pun intended) as to how things go. Thanks again for your help.

-R
0
Steve KnightIT ConsultancyCommented:
Odd, my script lines above didn't make it.   Anyway if that is an option we can add some lines to a VBScript or batch script to record last user, computer, etc. to text file(s), e.g. to \\server\share\users\username.txt, \\server\share\pc\computername.txt etc. to get an easy log of who was on each computer and user.

Is this on an Active Directory domain too as various information can be pulled from AD.

Steve

[Edit] - Your posts above crossed with mine, will leave at that!
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
@ netcmh,

The script gets through all the way to checking hardware. It seems to finish, but exports no csv file. Can you please assist?
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
Still need help, guys. Any thoughts???
0
netcmhCommented:
Sorry about the silence. Was offsite and had no access out.

Do you get to the "Script is complete, the results are here:" portion?
0
netcmhCommented:
Somethings to remember to help in troubleshooting powershell scripts:

use the write-host command to give feedback
write an event to the Event log when something occurs in the script as a checkpoint mechanism using Write-EventLog
or use debug as in http://technet.microsoft.com/en-us/library/ff730925.aspx
0
netcmhCommented:
Silly question, but you do have write access to C:\scripts\ or the location you decided on the $exportLocation variable, right?
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
@netcmh...

No worries at all for the silence. I've been up to my neck today, myself.

To answer your first and last question; yes to both. I am getting script is finished. But, since it's set to run silently, I wouldn't expect otherwise. I also do have write permissions to the location. It seems to choke on pulling the machine information. I tried the other script too (the one that builds the spreadsheet), and it populates on a home, then just chokes and gets stuck. I don't  understand.
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
On a home = one machine. Stupid autocorrect.
0
netcmhCommented:
After line 41's $i = 0;
add this line:
write-host "increment#" $i

&

After line 83's $OutputObj | Export-Csv $exportLocation -Append
add this line:
write-host "Completed" $Computer

Run the script again, and if it says Completed and the computername, and increment# 2, then the loop is incrementing and that the problem could be access to the next computer.
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
@ netcmh

Ok, so that worked a treat as far as letting me see if the machines were actually cycling through and completing. They all complete, but no csv file. I don't get it. Everything seems to complete beautifully, but no .csv populates. Ideas? I've tried pre-creating the  file to see if it would populate it, but no luck.
0
netcmhCommented:
So, you see the script cycle through your entire list, but it still doesn't create the file?

Can you check to see if the file exists during every increment? Could it be that it gets deleted at the end of the script run?
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
I keep the folder open (scripts folder) when I'm running it, but it doesn't appear that the file ever even gets created. Weird...
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
I've even done just one machine at a time and it doesn't create the file. It's definitely not a permissions issue. I'm logged on as the domain admin.
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
@netcmh .. should I post the final script here and maybe you, or someone, can see why it's not creating the file?
0
netcmhCommented:
Let's do that
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
$erroractionpreference = "SilentlyContinue"

# TXT file containing the computers your pinging
$testcomputers = gc -Path "C:\scripts\computers.txt"

$test_computer_count = $testcomputers.Length;
$x = 0;

write-host -foregroundcolor cyan ""
write-host -foregroundcolor cyan "Testing $test_computer_count computers, this may take a while."

foreach ($computer in $testcomputers) {
        # I only send 2 echo requests to speed things up, if you want the defaut 4
        # delete the -count 2 portion
   if (Test-Connection -ComputerName $computer -Quiet -count 2){
        Add-Content -value $computer -path c:\scripts\livePCs.txt
        }else{
        Add-Content -value $computer -path c:\scripts\deadPCs.txt
        }
    $testcomputer_progress = [int][Math]::Ceiling((($x / $test_computer_count) * 100))
      
    Write-Progress  "Testing Connections" -PercentComplete $testcomputer_progress -Status "Percent Complete - $testcomputer_progress%" -Id 1;
      Sleep(1);
    $x++;

}

write-host -foregroundcolor cyan ""
write-host -foregroundcolor cyan "Testing Connection complete"
write-host -foregroundcolor cyan ""

$ComputerName = gc -Path "C:\scripts\livePCs.txt"

$computer_count = $ComputerName.Length;

$exportLocation = "C:\scripts\pcInventory.csv"
$i = 0;
write-host "increment#" $i
 foreach ($Computer in $ComputerName){
   $Bios =get-wmiobject win32_bios -Computername $Computer
   $Hardware = get-wmiobject Win32_computerSystem -Computername $Computer
   $Sysbuild = get-wmiobject Win32_WmiSetting -Computername $Computer
   $OS = gwmi Win32_OperatingSystem -Computername $Computer
   $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer | ? {$_.IPEnabled}
   $driveSpace = gwmi win32_volume -computername $Computer -Filter 'drivetype = 3' |
   select PScomputerName, driveletter, label, @{LABEL='GBfreespace';EXPRESSION={"{0:N2}" -f($_.freespace/1GB)} } |
   Where-Object { $_.driveletter -match "C:" }
   $cpu = Get-WmiObject Win32_Processor  -computername $computer
   $username = Get-ChildItem "\\$computer\c$\Users" | Sort-Object LastWriteTime -Descending | Select Name, LastWriteTime -first 1
   $totalMemory = [math]::round($Hardware.TotalPhysicalMemory/1024/1024/1024, 2)
   $lastBoot = $OS.ConvertToDateTime($OS.LastBootUpTime)

   #write-host -foregroundcolor yellow "Found $computer"
   $computer_progress = [int][Math]::Ceiling((($i / $computer_count) * 100))
      
    Write-Progress  "Gathering Hardware Info" -PercentComplete $computer_progress -Status "Percent Complete - $computer_progress%" -Id 1;
      Sleep(1);
    $i++;
   foreach ($Network in $Networks) {
    $IPAddress  = $Network.IpAddress[0]
    $MACAddress  = $Network.MACAddress
    $systemBios = $Bios.serialnumber
    $OutputObj  = New-Object -Type PSObject
    $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
    $OutputObj | Add-Member -MemberType NoteProperty -Name Manufacturer -Value $Hardware.Manufacturer
    $OutputObj | Add-Member -MemberType NoteProperty -Name Model -Value $Hardware.Model
    $OutputObj | Add-Member -MemberType NoteProperty -Name CPU_Info -Value $cpu.Name
    $OutputObj | Add-Member -MemberType NoteProperty -Name SystemType -Value $Hardware.SystemType
    $OutputObj | Add-Member -MemberType NoteProperty -Name BuildVersion -Value $SysBuild.BuildVersion
    $OutputObj | Add-Member -MemberType NoteProperty -Name OS -Value $OS.Caption
    $OutputObj | Add-Member -MemberType NoteProperty -Name SPVersion -Value $OS.csdversion
    $OutputObj | Add-Member -MemberType NoteProperty -Name SerialNumber -Value $systemBios
    $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
    $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
    $OutputObj | Add-Member -MemberType NoteProperty -Name UserName -Value $username.Name
    $OutputObj | Add-Member -MemberType NoteProperty -Name Last-Login -Value $username.LastWriteTime
    $OutputObj | Add-Member -MemberType NoteProperty -Name C:_GBfreeSpace -Value $driveSpace.GBfreespace
    $OutputObj | Add-Member -MemberType NoteProperty -Name Total_Physical_Memory -Value $totalMemory
    $OutputObj | Add-Member -MemberType NoteProperty -Name Last_Reboot -Value $lastboot
    $OutputObj | Export-Csv $exportLocation -Append
 write-host "Completed" $Computer
   }
}

 write-host -foregroundcolor cyan "Script is complete, the results are here: $exportLocation"
0
netcmhCommented:
I was able to replicate your problem exactly. Let me run some debugs on this and I'll get back to you.
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
Thanks so much!
0
netcmhCommented:
I'm close but not done yet. Change the line 81 to $OutputObj | Export-CSV -NoType -Path $exportLocation

It'll get the info printed in the csv, but it's only the last computer. the append switch is not working. Still working on that.
0
netcmhCommented:
Ah, what version of powershell are you running?

-Append parameter has been added to export-csv, but it does not exist in 1.0 and 2.0
0
netcmhCommented:
alternatively, if you're ok with it, you could use
$OutputObj | Out-File -Append $exportLocation
0
netcmhCommented:
Ok, easy route. Upgrade your powershell to v3.0 and the script will work.

Or you can make a custom command as per http://dmitrysotnikov.wordpress.com/2010/01/19/export-csv-append/ to include the append. BUYER BEWARE! :)
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
Lol@buyer beware. I think I'll upgrade to 3.0. I'm pretty sure that's my problem! I'll try that and let you know. Again, thanks SOOOO much!
0
netcmhCommented:
remember to empty out your LivePCs list every time you run this
0
netcmhCommented:
How did it go?
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
I was just about to post when you rang....

The script is generating now. However, and another weird thing, it's only populating one or two users. For the rest, I'm getting the following errors: (more of my ramblings at the end of the errors)

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:4 char:16
+    $Sysbuild = get-wmiobject Win32_WmiSetting -Computername $Computer
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:5 char:10
+    $OS = gwmi Win32_OperatingSystem -Computername $Computer
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:6 char:16
+    $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName
$Co ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:7 char:18
+    $driveSpace = gwmi win32_volume -computername $Computer -Filter
'drivetype =  ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:10 char:11
+    $cpu = Get-WmiObject Win32_Processor  -computername $computer
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

You cannot call a method on a null-valued expression.
At line:13 char:4
+    $lastBoot = $OS.ConvertToDateTime($OS.LastBootUpTime)
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:2 char:11
+    $Bios =get-wmiobject win32_bios -Computername $Computer
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:3 char:16
+    $Hardware = get-wmiobject Win32_computerSystem -Computername $Computer
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:4 char:16
+    $Sysbuild = get-wmiobject Win32_WmiSetting -Computername $Computer
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:5 char:10
+    $OS = gwmi Win32_OperatingSystem -Computername $Computer
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:6 char:16
+    $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName
$Co ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:7 char:18
+    $driveSpace = gwmi win32_volume -computername $Computer -Filter
'drivetype =  ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:10 char:11
+    $cpu = Get-WmiObject Win32_Processor  -computername $computer
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

You cannot call a method on a null-valued expression.
At line:13 char:4
+    $lastBoot = $OS.ConvertToDateTime($OS.LastBootUpTime)
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:2 char:11
+    $Bios =get-wmiobject win32_bios -Computername $Computer
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:3 char:16
+    $Hardware = get-wmiobject Win32_computerSystem -Computername $Computer
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:4 char:16
+    $Sysbuild = get-wmiobject Win32_WmiSetting -Computername $Computer
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:5 char:10
+    $OS = gwmi Win32_OperatingSystem -Computername $Computer
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:6 char:16
+    $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName
$Co ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:7 char:18
+    $driveSpace = gwmi win32_volume -computername $Computer -Filter
'drivetype =  ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:10 char:11
+    $cpu = Get-WmiObject Win32_Processor  -computername $computer
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

You cannot call a method on a null-valued expression.
At line:13 char:4
+    $lastBoot = $OS.ConvertToDateTime($OS.LastBootUpTime)
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:2 char:11
+    $Bios =get-wmiobject win32_bios -Computername $Computer
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:3 char:16
+    $Hardware = get-wmiobject Win32_computerSystem -Computername $Computer
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

get-wmiobject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:4 char:16
+    $Sysbuild = get-wmiobject Win32_WmiSetting -Computername $Computer
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:5 char:10
+    $OS = gwmi Win32_OperatingSystem -Computername $Computer
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:6 char:16
+    $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName
$Co ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:7 char:18
+    $driveSpace = gwmi win32_volume -computername $Computer -Filter
'drivetype =  ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x800706BA)
At line:10 char:11
+    $cpu = Get-WmiObject Win32_Processor  -computername $computer
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMExcept
   ion
    + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands
   .GetWmiObjectCommand

You cannot call a method on a null-valued expression.
At line:13 char:4
+    $lastBoot = $OS.ConvertToDateTime($OS.LastBootUpTime)
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

- So I understand the RPC Server unavailable. But I do not understand the null-valued expression errors. Why would it work on some and not others? Also, why would it not just get what it could instead of skipping the computer altogether? You solved my initial problem, which I will give you full credit for, so if this is something I need to pursue in another question, I'm happy to - just let me know :) Again, thank you SO very much for all you've done.
0
netcmhCommented:
I don't know why that was happening. I checked elsewhere and found that if you have space characters at the end of each line the input file, it could occur. Can you check and let me know?
0
netcmhCommented:
Also, check if the Remote Procedure Call (RPC) service is running on the computers. If it is, then it's a firewall issue between your workstation and the server. You can test it by temporary disabling the firewall and retrying the command.
0
netcmhCommented:
It continues because of the SilentlyContinue parameter. If you'd like it to stop, try the Inquire parameter.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Roy BeneVP/Director - IT | ISOAuthor Commented:
I'll check and let you know. Give me just a bit. Again, thanks a ton!!
0
mlmccCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
mlmccCommented:
The asker has had approcimately 50 days to respond.  I doubt a couple more will make any difference.

mlmcc
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
Well 'the asker' has responded. Thanks.
0
netcmhCommented:
LOL! Thanks roycbene. Hope you got it to work the way you wanted it. Good luck! Oh, and thanks for the grade.
0
Roy BeneVP/Director - IT | ISOAuthor Commented:
Thank you!!! It took some tweaking, but I finally got it. You're a genius and thanks again!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.