smbcomputers Posted January 5, 2020 Share Posted January 5, 2020 I have a script that launches a powershell script. once the script launches Run('powershell.exe -executionpolicy bypass -windowstyle hidden -noninteractive -nologo -sta -file X:\Windows\temp\SkyActivePassword.ps1"') WinPE reboots. It not crashing as if i put a sleep(30000) it will not reboot until that timer is up. The only way we got it to partially to work is RunWait(@ComSpec & ' /c PowerShell.exe -ExecutionPolicy Bypass -sta -File "' & $sFilePath3 & '"') #sFilePath3 variable to ps1 But then the CMD never closes and imaging never reboots on its on as it should. How can i get a powershell script to launch, run and not reboot the machine when the autoit script finishes but the powershell script is still running. Any assistance would be greatly appreciated. Link to comment Share on other sites More sharing options...
Subz Posted January 5, 2020 Share Posted January 5, 2020 Are you sure PS script is closing after it's completed? Can you try running the command manually within WinPE and checking whether the process is ending? Based upon your RunWait command it doesn't sound like it is closing which is why the cmd remains open. You could try using ProcessWaitClose after Run(...) but I expect you're encounter the same issue. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now