Prompt text box and store input in variable

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Curtis Smith Curtis Smith 11 months, 2 weeks ago.

  • Author
  • #31796
    Profile photo of Jeff

    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 (
    $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
  • #31851
    Profile photo of Jeff

    Any ideas?

  • #31853
    Profile photo of Curtis Smith
    Curtis Smith

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

You must be logged in to reply to this topic.