Skip to content

Instantly share code, notes, and snippets.

@RhysC
Created February 28, 2011 23:17
Show Gist options
  • Save RhysC/848255 to your computer and use it in GitHub Desktop.
Save RhysC/848255 to your computer and use it in GitHub Desktop.
Retrieve details for the machine
#Audit script
$auditFile = "audit.txt"
$computername = "." #i.e local machine
"Computer name $computername" > $auditFile
"Computer details:" >> $auditFile
get-wmiobject Win32_ComputerSystem -computername $computername |
select Name, Manufacturer, Model,`
NumberOfProcessors, TotalPhysicalMemory, `
Domain, CurrentTimeZone, DayLightInEffect |
Format-List|
Out-File $auditFile -Append
#os details
"OS details:" >> $auditFile
get-wmiobject Win32_OperatingSystem -computername $computername |
select Caption, ServicePackMajorVersion, ServicePackMinorVersion |
Format-List|
Out-File $auditFile -Append
#CLR versions
".Net details:" >> $auditFile
Get-ChildItem "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP" | Get-ItemProperty|
Format-List|
Out-File $auditFile -Append
#powershell version
"PowerShell version:" >> $auditFile
$Host.Version >> $auditFile
#silverlight version
"`r`nSilverlight version:" >> $auditFile
(get-itemproperty HKLM:\SOFTWARE\Microsoft\Silverlight Version).Version >> $auditFile
#Environment variables
"`r`nEnvironment variables:" >> $auditFile
[Environment]::GetEnvironmentVariables()|
Format-List|
Out-File $auditFile -Append
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment