Author Posts

November 9, 2015 at 6:04 am

I currently have a script to approve requests for applications in SCCM. Instead of having the text "Request approved" below, I would like the "approve" action to prompt a text box where the user can put in some text, select OK, and store it in a variable that will go in the same place that "Request approved" previously was. FYI – $button1 is the "Approve" button.

function Set-ApprovalRequest {
    param (
    [string]$Action
    )
$User = $comboBox1.SelectedItem
If ($Action -eq "Approve") {
     $ApplAppr = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User} | Where-Object -FilterScript {$_.Application -eq $ApplName}
     $ApplAppr.Approve('Request approved')
     }
}

$button1_OnClick= {
        $Action = "Approve"
        Set-ApprovalRequest $Action
}

November 10, 2015 at 8:52 am

well, it looks like you are using windows forms, why not just add a textbox in the form for the user to fill in?