Thursday, June 8, 2017

Powershell Script for Dialogue Box creation

I came across a very small script which will provide the notification dialogue box yes/No . Using this script format we can use dialogue box as per our requirement and put validation, information etc. as per the requirement.

Please check all the buttons in below as per your business requirement.

# Author: Swagat Rout
# Purpose: How Can I Give a User a Yes/No Prompt in Powershell?

$a = new-object -comobject wscript.shell
$b= $a.popup("Do you want to delete these files?", `
0,"Delete Files",4)

If ($intAnswer -eq 6)
 {
        Write-host ("You answered yes.")
}
 else
 {
         Write-host ("You answered no.")
}

#Button Types
#
#Value Description
#0 Show OK button.
#1 Show OK and Cancel buttons.
#2 Show Abort, Retry, and Ignore buttons.
#3 Show Yes, No, and Cancel buttons.
#4 Show Yes and No buttons.
#5 Show Retry and Cancel buttons. 

No comments:

Test Script

############################################################################## #####################################################...