I have a very tiny simple script (see below) checking all workstations inside my AbleToConnect.txt to see if the individual workstation has OPP installed in it or not. If it has OPP, it will do export-csv to ConfirmedOPPInstalled.csv. I got this part to
work the way I wanted it. However, my challenge is that I was not able to get it to export the workstation(s) that do not have OPP installed into NoOPPInstalled.txt file. What am I missing?
$Workstations = Get-Content .\result\AbleToConnect.txt
foreach ($workstation in $Workstations) {
write-verbose "Working on $workstation..." -Verbose
Invoke-Command "$workstation" -ScriptBlock {
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\O365ProPlus* | Select-Object DisplayName, DisplayVersion, Publisher
} | export-csv ".\result\ConfirmedOPPInstalled.csv" -Append -Force
}
For you experts this can be done with your eyes closed :)
I'm still learning....
Thanks!
TX