Quick Powershell References

Powershell is just that, a very powerful tool!

I’ll start adding some references to various powershell scripts I find myself using often. I hope you find the snippets I post here helpful over time. So without futher ado … here we go!

  1. This Powershell reference helps us get the software inventory from a PC
    1. PS C:> Get-CimInstance win32_product | Select-Object Name, PackageName, InstallDate | Out-GridView
    2. Or for remote, and ensuring WinRM is enabled on your PC(s) (by default it is enabled on servers) do the following:
      PS C:> (Get-ADComputer -Filter * -Searchbase “OU=TargetOU, DC=yourdomainname, DC=yourdomainextension”).Name | Out-File C:\Temp\Computer.txt | notepad C:\Temp\Computer.txt
    3. Then we’ll call the resultant file, in this example “C:\Temp\Computer.txt”
      PS C:>Get-CimInstance -ComputerName (Get-Content PS C:\Temp\Computer.txt) -ClassName win32_product -ErrorAction SilentlyContineu| Select-Object PSComputerName, Name, PackageName, InstallDate | Out-GridView

Currently, I’m trying to document a small environment that doesn’t have inventory tools on-hand 😉
Powershell to the Rescue!!