Hi,
I' d like to follow up a deployment of an App-V package very closely and need direct output. That's why I created a powershellscript below which checks for the App-V package on the client itself. I know it's a bit messy and can be optimized but that's something
for later. I know it's a lot what I ask here, but it's worth a shot :-) ....
It works fine but I'd like to add some more things:
-while it's outputting the $Installed variable, can I put the output on the screen while it's running? I'd like that since it takes a long time to process it and I'm in the dark while it runs
-I'd like to put the $PackageName in the $Installed variable but with $using or param() I cannot seem to make that work
-I do have a list with computers which have the app-v package NOT installed and would like at least to open their ccm logs folder (but that throws an error "failed with the following error message : WinRM cannot complete the operation.") whereas I
can open it with explorer without any problem + powershell remoting IS enabled (otherwise I couldn't execute my commands)
Ideallically I'd like to search through those logs for $Packagename and put the output per pc in a nice view (gridview?)
Please advise.
J.
$CollectionName = "MyInstallCollection" $PackageName = "MyPackage*" $CollectionID = Get-CMDeviceCollection -Name $CollectionName | Select CollectionID $Computers = Get-CMDevice -CollectionId $CollectionID.CollectionID | Select -Expand Name ##Check for installed package on collection $Installed = foreach ($Computer in $Computers) { if (Test-Connection -ComputerName $Computer -Quiet) { invoke-command -ScriptBlock { Get-AppvClientPackage -name *IBM* | select -Property PSComputerName,Name} -ComputerName $Computer -verbose} } Date write-host "Number of Computers in"'"'$CollectionName '"' ":" $Computers.count write-host "Number of Computers which have the App-V package" ":" $Installed.count $Percentage = [int]($installed.count/$computers.count * 100) write-host "Percentage installed:" $Percentage "%"
#Compare lists then look for logs in computers which don't have the package
$ComputersInstalled = $installed | Select-Object -Property pscomputername -ExpandProperty pscomputername
$NotInstalled = Compare-Object $ComputersInstalled -DifferenceObject $Computers
$ComputersNotInstalled = $NotInstalled | Select-Object -Property Inputobject | select -ExpandProperty inputobject
foreach ($Computer in $ComputersNotInstalled)
{
invoke-command -ScriptBlock { explorer "\\$computer\c$\windows\ccm\logs"} -ComputerName $Computer -verbose
}