Friday, March 18, 2016

Powershell --> Powerquick : get (some) important remote pc info

Hi mates,
here again with a quick Powershell script that could help you during the day by day routine.
Some info to retrieve from a remote pc that could be useful for a massive software installation, to group specific computer with specific software installed, to......it's up to your fantasy.
Obviously you can find thousand of this kind of script on the internet but I feel the need to share, share and share......
Improve it without any limit.....



# if you know the pc name use this line
$pc = "remotepc"
# otherwise if you don't know the netbios name but only the ip....
# uncomment the following three lines and comment the one above
#$ip = "172.16.11.XX"
#$pc = ([system.net.dns]::GetHostByAddress($ip)).hostname
#$pc
# here you will have immediately the username of the user currently connected to it
gwmi Win32_ComputerSystem -ComputerName $pc | select Name,UserName
# here you will retrieve some info about the client : OS, SPack and so on
# add all WMI information that could help you
$genericinfo =Get-WmiObject -class Win32_OperatingSystem -computername $pc
foreach($Property in $genericinfo)
{
write-host $Property.Description
write-host $Property.Caption
write-host $Property.OSArchitecture
write-host $Property.ServicePackMajorVersion
}
# here you will have the result of installed software filtered by a specific name that I'm searching for
Invoke-Command -cn $pc -ScriptBlock {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | where {$_.dysplayname -like "*searched software*"} | Format-Table –AutoSize}
# the alternative is to have the full list of installed software.....
Invoke-Command -cn $pc -ScriptBlock {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | where {$_.displayname} | Format-Table –AutoSize}
view raw pcinfo.ps1 hosted with ❤ by GitHub

I hope this help.
Bye

No comments:

Post a Comment