Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

a litttle help formatting output from powershell?

$
0
0

Hi all, I am working on a software inventory project and am (as will become obvious) a novice at powershell.  I have the script running so I get what I need, but the formatting is borderline un-useable.  I would like to see if anyone can point me in the direction of creating one or two of the following: a single, collated file of all installed programs on all computers in the OU, filtered for duplicates (ie, only unique entries, not 37 instances of Office 2010 Service Pack 2), and/or an excel worksheet with a page for each pc in the OU, and the list of installed programs on each page.  This is what I have so far:


$rtn = $null

Get-ADComputer -filter '*' -searchbase 'ou=levy chd, dc=doh,dc=ad,dc=state,dc=fl,dc=us'|

ForEach-Object {

  $rtn = Test-Connection -CN $_.dnshostname -Count 1 -BufferSize 16 -Quiet

  IF($rtn -match 'True') {write-output $_.name | out-file C:\chd38computers_ping=true.csv -Append }

  ELSE { write-output $_.name | out-file C:\chd38computers_ping=false.txt -Append }

}


$computers = Import-Csv "C:\chd38computers_ping=true.csv"


foreach($obj in $computers){
Get-WmiObject -Class win32reg_addremoveprograms | Select DisplayName,Publisher,Version,Installdate | Sort Publisher -Descending| Export-Csv d:\installed_apps.csv -append
}
Thanks in advance for the help!

adam


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>