rinomardo2
(badbanana)
1
not mine. got it from the corners of the nets. very useful for me, did some modifications for my use.
this will list remote PC information.
# Remote System Information
# Shows hardware and OS details from a list of PCs
# Thom McKiernan 22/08/2014
#
# modified by me: Dec 17, 2017
# to change filter to "DeviceID='C:'" for those computers with more than one partition or drives
# also to read input from CSV and to output to CSV; much more flexible format
#
$ArrComputers = Import-Csv D:\scripts\ADcomputers.csv
Clear-Host
foreach ($Computer in $ArrComputers)
{
echo $Computer
$computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer
$computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer
$computerOS = get-wmiobject Win32_OperatingSystem -Computer $Computer
$computerCPU = get-wmiobject Win32_Processor -Computer $Computer
$computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $Computer -Filter "DeviceID='C:'"
$csvObject = New-Object PSObject -property @{
'PCName' = $computerSystem.Name
'Manufacturer' = $computerSystem.Manufacturer
'Model' = $computerSystem.Model
'SerialNumber' = $computerBIOS.SerialNumber
'RAM' = "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB)
'HDDSize' = "{0:N2}" -f ($computerHDD.Size/1GB)
'HDDFree' = "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size)
'CPU' = $computerCPU.Name
'OS' = $computerOS.caption
'SP' = $computerOS.ServicePackMajorVersion
'User' = $computerSystem.UserName
'BootTime' = $computerOS.ConvertToDateTime($computerOS.LastBootUpTime)
}
#Export the fields you want from above in the specified order
$csvObject | Select-Object PCName, Manufacturer, Model, SerialNumber, HDDSize, CPU, Ram, OS, SP | Export-Csv 'd:\scripts\PCinfo.csv' -NoTypeInformation -Append
}
# Open CSV file for review (leave this line out when deploying)
#notepad system-info.csv
9 Spice ups
dbeato
(dbeato)
2
Sounds like a good script, or you can run it against all your workstations in AD as well without the CSV.
jitensh
(JitenSh)
3
It should be
# all computers
$ArrComputers=get-adcomputer -filter * |select -exp Name
#only servers
get-adcomputer -filter {operatingsystem -like '*server*'} |select -exp Name
@badbanana share your script here
https://community.spiceworks.com/scripts
2 Spice ups
martin9700
(Martin9700)
4
The problem with it is you have to edit the text file first and THEN run the script. Better to just run the script and provide it parameters. I did something similar and allow parameters, pipeline, even pipeline from Get-ADComputer.
DoctorDNS
(DoctorDNS)
5
This is a nice script, but you really need to turn it into a tool.
That means:
-
Refactoring the core of the code into one or more functions
-
Decorating those functions with all the relevant atttributes for the paramaters.
-
Adding comment based help into the functions
-
Packaging the functions into a module.
-
Write a controller script that accepts user input - either as a GUI OR a CSV and gets the relevant info.