PowerShell

PowerShell: Documenting your environment by running systeminfo on all Domain-Computers

Systeminfo gives you a perfect overview of your system. But what about the other systems in your domain? Sure, you can use 3rd Party Tools or SCCM. But the number of those who can´t use enterprise software is greater than you think. In this article I am going to describe how to run systeminfo on all Client Computer without using 3rd Party Tools.

What is systeminfo?

Open PowerShell. Type systeminfo.

systeminfo

Unbenannt.PNG

Next, the goal is to get that useful information for all Domain Computers.

Running systeminfo on all Domain Computers

Log on to the domain as a Member of the Domain Admins Group. Run the following command:

(Get-ADComputer -Filter *).Name | Foreach-Object {Invoke-Command -ComputerName $_ {systeminfo /FO CSV}} | ConvertFrom-Csv | Out-GridView

Unbenannt.PNG

This will give you a perfect overview of your environment. But we are faced with two problems. Those red one’s are not good one’s 😉

Problem 1

If you get an error, then one of your workstations or servers isn´t responding. The reason can be manifold. The computer might be switched off.

Unbenannt1.PNG

To avoid this, run Foreach-Object with the parameter -ErrorAction SilentlyContinue.

(Get-ADComputer -Filter *).Name | Foreach-Object {Invoke-Command -ComputerName $_ {systeminfo /FO CSV} -ErrorAction SilentlyContinue} | ConvertFrom-Csv | Out-GridView

Problem 2

Now let´s solve the next problem. Let´s remove the annoying Header Lines. We want only one header for all computers.

Unbenannt3.PNG

To remove the multiple headers run

(Get-ADComputer -Filter *).Name | Foreach-Object {Invoke-Command -ComputerName $_ {systeminfo /FO CSV} -ErrorAction SilentlyContinue | Select-Object -Skip 1} | ConvertFrom-Csv -Header "Host Name","OS","Version","Manufacturer","Configuration","Build Type","Registered Owner","Registered Organization","Product ID","Install Date","Boot Time","System Manufacturer","Model","Type","Processor","Bios","Windows Directory","System Directory","Boot Device","Language","Keyboard","Time Zone","Total Physical Memory","Available Physical Memory","Virtual Memory","Virtual Memory Available","Virtual Memory in Use","Page File","Domain","Logon Server","Hotfix","Network Card","Hyper-V" | Out-GridView

Unbenannt.PNG

Perfect. 😉

Have fun documenting your systems.

See also

PowerShell: Force gpupdate on all Domain Computers

Restart all Domain Computers by using PowerShell

PowerShell: Enable Remote Desktop on multiple Servers remotely (Bulk)

17 replies »

  1. I’m trying to write a PS scripts to collect information where i can point to a txt or csv file to extract a list of computers, then the outcomes are digested into a single file.

    Liked by 1 person

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.