https://github.com/auberginehill/get-computer-info
Retrieves basic computer information from specified computers (a Windows PowerShell script).
https://github.com/auberginehill/get-computer-info
computer computer-info computers powershell powershell-script windows
Last synced: 11 months ago
JSON representation
Retrieves basic computer information from specified computers (a Windows PowerShell script).
- Host: GitHub
- URL: https://github.com/auberginehill/get-computer-info
- Owner: auberginehill
- License: other
- Created: 2016-08-01T14:50:16.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-02T21:34:17.000Z (over 9 years ago)
- Last Synced: 2024-08-13T07:05:37.128Z (almost 2 years ago)
- Topics: computer, computer-info, computers, powershell, powershell-script, windows
- Language: PowerShell
- Homepage:
- Size: 242 KB
- Stars: 19
- Watchers: 1
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- jimsghstars - auberginehill/get-computer-info - Retrieves basic computer information from specified computers (a Windows PowerShell script). (PowerShell)
README
## Get-ComputerInfo.ps1
OS:
Windows
Type:
A Windows PowerShell script
Language:
Windows PowerShell
Description:
Get-ComputerInfo uses Windows Management Instrumentation (WMI) and reads the "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" registry key to retrieve basic computer information, a list of volumes and partition tables of the computers specified with the -Computer parameter (and/or inputted via a text file with the -File parameter). The results are displayed on-screen and written to a CSV- and a HTML-file. The default output destination folder $env:temp, which points to the current temporary file location, may be changed with the -Output parameter.
With five additional parameters (switches) the amount of gathered data may be enlarged: -SystemInfo parameter will launch the systeminfo.exe /fo LIST Dos command, -MsInfo32 parameter opens the System Information (msinfo32) window, -Extract parameter will export the System Information (msinfo32.exe) data to a TXT- and a NFO-file (and on machines running PowerShell version 5.1 or later convert the data to a XML-file). The -GatherNetworkInfo parameter will launch the native GatherNetworkInfo.vbs script (which outputs to $env:temp\Config folder and doesn't follow the -Output parameter) and -Cmdlet parameter will try to launch the native PowerShell Get-ComputerInfo cmdlet and output its data to text files. This script is based on clayman2's PowerShell script "Disk Space" (or one of the archive.org versions).
Homepage:
https://github.com/auberginehill/get-computer-info
Short URL: http://tinyurl.com/jxvhufb
Version:
1.4
Sources:
Emojis:
Emoji Table
clayman2:
Disk Space (or one of the archive.org versions)
Jeff Hicks:
Validating Computer Lists with PowerShell
Paul-De:
Does anyone know what gatherNetworkInfo.vbs is?
alejandro5042:
How to run exe with/without elevated privileges from PowerShell
Jeff:
Powershell show elapsed time
Downloads:
For instance Get-ComputerInfo.ps1. Or everything as a .zip-file.
### Screenshot

### Parameters
:triangular_ruler:
-
Parameter
-Computer
with an alias
-ComputerName. The-Computerparameter determines the objects (i.e. the computers) for Get-ComputerInfo. To enter multiple computer names, please separate each individual computer name with a comma. The-Computerparameter also takes an array of strings and objects could be piped to this parameter, too. If no value for the-Computerparameter is defined in the command launching Get-ComputerInfo, the local machine will be defined as the-Computerparameter value.
-
Parameter
-Output
with an alias
-ReportPath. Specifies where most of the files are to be saved. The default save location is$env:temp, which points to the current temporary file location, which is set in the system. The default-Outputsave location is defined at line 15 with the$Outputvariable. In case the path name includes space characters, please enclose the path name in quotation marks (single or double). For usage, please see the Examples below and for more information about$env:temp, please see the Notes section below. Please note that the output folder for the-GatherNetworkInfoparameter is hard coded inside the vbs script and cannot be changed with-Outputparameter.
-
Parameter
-File
with aliases
-ListOfComputersInATxtFileand-List. The-Fileparameter may be used to define the path to a text file, which contains computer names or IP addresses (one in each line). If the full filename or the directory name includes space characters, please enclose the whole inputted string in quotation marks (single or double).
-
Parameter
-SystemInfo
If the
-SystemInfoparameter is added to the command launching Get-ComputerInfo, asysteminfo.exe /fo LISTDos command is eventually launched, which outputs asystem_info.txttext file.
-
Parameter
-Extract
with aliases
-ExtractMsInfo32ToAFile,-ExtractMsInfo32,-MsInfo32ContentsToFile,-MsInfo32Report,-Expandand-Export. If the-Extractparameter is added to the command launching Get-ComputerInfo, the data contained by the System Information (msinfo32.exe) program is exported toms_info.txtandms_info.nfofiles, and on machines running PowerShell version 5.1 or later the data is also converted to a XML-file. Please note that this step will have a drastical toll on the completion time of this script, because each of the three steps may run for minutes.
-
Parameter
-MsInfo32
with aliases
-OpenMsInfo32PopUpWindowand-Window. By adding the-MsInfo32parameter to the command launching Get-ComputerInfo, the System Information (msinfo32) window may be opened.
-
Parameter
-GatherNetworkInfo
with an alias
-Vbs. If the-GatherNetworkInfoparameter is added to the command launching Get-ComputerInfo, a nativeGatherNetworkInfo.vbsscript (which outputs to$env:temp\Configfolder and doesn't follow the-Outputparameter) is also eventually executed when Get-ComputerInfo (this script) is run. The vbs script resides in the%WINDOWS%\system32directory and amasses an extensive amount of computer related data to the%TEMP%\Configdirectory when run. On most Windows machines theGatherNetworkInfo.vbsscript has by default a passive scheduled task in the Task Scheduler (i.e. Control Panel → Administrative Tools → Task Scheduler), which for instance can be seen by opening inside the Task Scheduler a Task Scheduler Library → Microsoft → Windows → NetTrace → GatherNetworkInfo tab. TheGatherNetworkInfo.vbsscript will probably run for a few minutes. Please note that for best results it's mandatory to run the GatherNetworkInfo.vbs in an elevated instance (an elevatedcmd-prompt or an elevated PowerShell window).
-
Parameter
-Cmdlet
with aliases
-GetComputerInfoCmdletand-GetComputerInfo. The parameter-Cmdletwill try to launch the native PowerShellGet-ComputerInfocmdlet and output its data tocomputer_info.txtandcomputer_info_original.txttext files. Please note that the inbuiltGet-ComputerInfocmdlet was first introcuded probably in PowerShell v3.1 or in PowerShell v5.1 at the latest. TheGet-Command 'Get-ComputerInfo'command may search for this cmdlet and$PSVersionTable.PSVersionmay reveal the PowerShell version.
### Outputs
:arrow_right:
- Displays general computer information (such as Computer Name, Manufacturer, Computer Model, System Type, Domain Role, Product Type, Chassis, PC Type, whether the machine is a laptop or not (based on the chassis information), Model Version, CPU, Video Card, Resolution, Operating System, Architecture, Windows Edition ID, Windows Installation Type, Windows Platform, Type, SP Version, Windows BuildLab Extended, Windows BuildLab, Windows Build Branch, Windows Build Number, Windows Release Id, Current Version, Memory, Video Card Memory, Logical Processors, Cores, Physical Processors, Country Code, OS Language, Video Card Driver Date, BIOS Release Date, OS Install Date, Last BootUp, UpTime, Date, Daylight Bias, Time Offset (Current), Time Offset (Normal), Time (Current), Time (Normal), Daylight In Effect, Time Zone, Connectivity (network adapters), Mobile Broadband, OS Version, PowerShell Version, Video Card Version, BIOS Version, Mother Board Version, Serial Number (BIOS), Serial Number (Mother Board), Serial Number (OS), UUID), and a list of volumes in console. Opens the generated HTML-file in the default browser. By default writes two files to
$env:tempor at the location specified with the-Outputparameter.
- Default values:
- Optional files with the default
-Outputpath (the files are generated, if the corresponding parameters (switches) are added to the command launching Get-ComputerInfo):
Path
Type
Name
$env:temp\computer_info.html
HTML-file
computer_info.html
$env:temp\computer_info.csv
CSV-file
computer_info.csv
Path
Parameter (switch)
Type
$env:temp\system_info.txt
-SystemInfo
TXT-file
$env:temp\ms_info.txt
-Extract
TXT-file
$env:temp\ms_info.nfo
-Extract
NFO-file
$env:temp\ms_info.xml
-Extract
XML-file1
$env:temp\computer_info.txt
-Cmdlet
TXT-file
$env:temp\computer_info_original.txt
-Cmdlet
TXT-file
$env:temp\Config
-GatherNetworkInfo
Folder with files and a subfolder
1 On machines running PowerShell version 5.1 or later
### Notes
:warning:
- Please note that all the parameters can be used in one get computer info command and that each of the parameters can be "tab completed" before typing them fully (by pressing the
[tab]key).
- Please note that the files (apart from the outputs of the
-GatherNetworkInfoparameter) are created in a directory, which is end-user settable in each get computer info command with the-Outputparameter. The default save location is defined with the$Outputvariable (at line 15). The$env:tempvariable points to the current temp folder. The default value of the$env:tempvariable isC:\Users\<username>\AppData\Local\Temp(i.e. each user account has their own separate temp folder at path%USERPROFILE%\AppData\Local\Temp). To see the current temp path, for instance a command
[System.IO.Path]::GetTempPath()
may be used at the PowerShell prompt window[PS>]. To change the temp folder for instance toC:\Temp, please, for example, follow the instructions at Temporary Files Folder - Change Location in Windows, which in essence are something along the lines:
- Right click on Computer and click on Properties (or select Start → Control Panel → System). In the resulting window with the basic information about the computer...
- Click on Advanced system settings on the left panel and select Advanced tab on the resulting pop-up window.
- Click on the button near the bottom labeled Environment Variables.
- In the topmost section labeled User variables both TMP and TEMP may be seen. Each different login account is assigned its own temporary locations. These values can be changed by double clicking a value or by highlighting a value and selecting Edit. The specified path will be used by Windows and many other programs for temporary files. It's advisable to set the same value (a directory path) for both TMP and TEMP.
- Any running programs need to be restarted for the new values to take effect. In fact, probably also Windows itself needs to be restarted for it to begin using the new values for its own temporary files.
### Examples
:book:
To open this code in Windows PowerShell, for instance:
-
./Get-ComputerInfo
Run the script. Please notice to insert./or.\before the script name. Gathers information about the local machine, displays the data in console, outputs the default two files to the default-Outputlocation ($env:temp) and opens the created HTML-file in the default browser. -
help ./Get-ComputerInfo -Full
Display the help file. -
./Get-ComputerInfo -Computer dc01, dc02 -Output "E:\chiore"-SystemInfo-Extract -MsInfo32 -Vbs -Cmdlet
Run the script and get all the available computer related information from the computersdc01anddc02. Save most of the results in the "E:\chiore" directory (the results of theGatherNetworkInfo.vbsare saved to$env:temp\Configfolder, if the command launching Get-ComputerInfo was run in an elevated PowerShell window). This command will work, because-Vbsis an alias of-GatherNetworkInfo. Since the path name doesn't contain any space characters, it doesn't need to be enveloped with quotation marks, and furthermore, the word-Computermay be left out from this command, too, because the valuesdc01anddc02are accepted as computer names due to their position (first). -
Set-ExecutionPolicy remotesigned
This command is altering the Windows PowerShell rights to enable script execution for the default (LocalMachine) scope. Windows PowerShell has to be run with elevated rights (run as an administrator) to actually be able to change the script execution properties. The default value of the default (LocalMachine) scope is "Set-ExecutionPolicy restricted".
Parameters:
Restricted
Does not load configuration files or run scripts. Restricted is the default execution policy.
AllSigned
Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.
RemoteSigned
Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
Unrestricted
Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs.
Bypass
Nothing is blocked and there are no warnings or prompts.
Undefined
Removes the currently assigned execution policy from the current scope. This parameter will not remove an execution policy that is set in a Group Policy scope.
For more information, please type "
Get-ExecutionPolicy -List", "help Set-ExecutionPolicy -Full", "help about_Execution_Policies" or visit Set-ExecutionPolicy or about_Execution_Policies.
-
New-Item -ItemType File -Path C:\Temp\Get-ComputerInfo.ps1
Creates an empty ps1-file to theC:\Tempdirectory. TheNew-Itemcmdlet has an inherent-NoClobbermode built into it, so that the procedure will halt, if overwriting (replacing the contents) of an existing file is about to happen. Overwriting a file with theNew-Itemcmdlet requires using theForce. If the path name and/or the filename includes space characters, please enclose the whole-Pathparameter value in quotation marks (single or double):
New-Item -ItemType File -Path "C:\Folder Name\Get-ComputerInfo.ps1"
For more information, please type "help New-Item -Full".
### Contributing
Find a bug? Have a feature request? Here is how you can contribute to this project:
Bugs:
Submit bugs and help us verify fixes.
Feature Requests:
Feature request can be submitted by creating an Issue.
Edit Source Files:
Submit pull requests for bug fixes and features and discuss existing proposals.
### www
Script Homepage
clayman2: Disk Space (or one of the archive.org versions)
Jeff Hicks: Validating Computer Lists with PowerShell
Paul-De: Does anyone know what gatherNetworkInfo.vbs is?
alejandro5042: How to run exe with/without elevated privileges from PowerShell
Jeff: Powershell show elapsed time
Powershell - Get-WmiObject and ASSOCIATORS OF Statement
Windows Server 2012 Server Core - Part 5: Tools
How to link the output from win32_diskdrive and win32_volume
How to use System Information (msinfo32) command-line tool switches
Windows PowerShell Tip of the Week: More Fun with Dates (and Times)
Systeminfo
Msinfo32
Win32_ComputerSystem class
Win32_OperatingSystem class
Win32_SystemEnclosure class
Win32_VideoController class
Win32_POTSModem class
Win32_NetworkAdapter class
Cscript
Stopwatch Class
Where-Object
Start-Job
About Jobs
Get-ComputerInfo
WinRM (Windows Remote Management) Troubleshooting
A Few Good Vista WS-Man (WinRM) Commands
An Introduction to WinRM Basics
How to Correctly Check if a Process is running and Stop it
Appendix B. Regular Expression Reference
The GatherNetworkInfo.vbs script
Get-ComputerInfo returns empty values on Windows 10 for most of the properties
The String’s the Thing
Powershellv2 - remove last x characters from a string
ASCII Art: http://www.figlet.org/ and ASCII Art Text Generator
### Related scripts
Disable-Defrag
Firefox Customization Files
Get-AsciiTable
Get-BatteryInfo
Get-CultureTables
Get-DirectorySize
Get-HashValue
Get-InstalledPrograms
Get-InstalledWindowsUpdates
Get-PowerShellAliasesTable
Get-PowerShellSpecialFolders
Get-RAMInfo
Get-TimeDifference
Get-TimeZoneTable
Get-UnusedDriveLetters
Emoji Table
Java-Update
Remove-DuplicateFiles
Remove-EmptyFolders
Remove-EmptyFoldersLite
Rename-Files
Rock-Paper-Scissors
Toss-a-Coin
Unzip-Silently
Update-AdobeFlashPlayer
Update-MozillaFirefox