Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Default params if no input given.
- param (
- [string]$txtFileName="default",
- [int]$duration=0,
- [string]$title="CompanyName IT"
- )
- #Path to message repo
- $msgPath = ("\\namespace\it\deploy\_messages\" + $txtFileName + ".txt")
- #exit early if txt file doesn't exist
- If (-Not (Test-Path $msgPath)) {
- exit 1
- }
- $msg = Get-Content -Path $msgPath | Out-String
- #Spawns a new job allowing current script to exit succesfully.
- #Doesn't work with PDQ for some reason
- Start-Job -ScriptBlock {
- param ($msg, $duration, $title)
- $a = new-object -comobject wscript.shell
- $intAnswer = $a.popup($msg,$duration,$title,0+32+4096)
- get-job | remove-job
- } -ArgumentList $msg,$duration,$title | Out-Null
- return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement