|
Post by mortennf on Jan 10, 2019 14:15:30 GMT
Anyone Successful run a Powershell script?
I have made a test script, placed it in the same folder as UI++64.exe
In my XML file I have:
<Action Type="ExternalCall" Title="Run Powershell Script TEST" >Powershell.exe -ExecutionPolicy ByPass -File test.ps1</Action> But the script do not run.
My PS script:
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Operation Completed",0,"Done",0x1) should show a little Popup
|
|
|
Post by mortennf on Jan 10, 2019 14:16:16 GMT
By the way, it's done in testing, I'm aware of powershell should be enabled when done in WinPE
|
|
Chris
New Member
Posts: 5
|
Post by Chris on Jan 10, 2019 17:32:16 GMT
I haven't done it from the same folder as UI++ as I download the Script from IIS to the TEMP Folder immediately prior to executing but I have it working with the following.
<Action Type="ExternalCall" Title="Download Add to Collection Script">PowerShell.exe -Command "& { $WebClient = New-Object System.Net.WebClient ; $Url = '%ZZHTTPDownloadLocation%/Scripts/AddToCollection.txt' ; $Path = $ENV:Temp+'\AddToCollection.ps1' ; $WebClient.DownloadFile( $url, $path ) }"</Action> <Action Type="ExternalCall" Title="Execute Add to Collection Script">PowerShell.exe -ExecutionPolicy ByPass -File "X:\Windows\Temp\AddToCollection.ps1"</Action>
|
|
|
Post by mortennf on Jan 12, 2019 10:41:23 GMT
Hi Chris
Thank You, my problem was that UI++ properly did not now where the PS file was, as soon as I made a copy of the ps1 file to my C:\Temp and used that in UI++ it ran the powershell script wahoooo :-)
Just one Question, %zzHTTPDownloadLocation% is set to something like "http://YourSCCMserver/wwwroot" and defined in the start of your UI++ xml?
|
|