The following is a powershell script option.
$Requests = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Select-Object User,Application,CurrentState,Comments | Sort-Object User
$Count = @($Requests).Count
for ($i=0; $i -lt $count; $i++) {
if ($Requests[$i].CurrentState -eq '1') {
$Requests[$i].CurrentState = "Pending"
$checkbox1.Enabled = $true
}
when i execute the script i get the following error.
Unable to index into an object of type System.Management.Automation.PSObject.
if ($Requests[ <<<< $i].CurrentState -eq '1') {
+ CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
What I want to do is replace the value (1) with Pending.
source
share