Computer Startup and Powershell Scripts
I am tasked with converting our batch files to Powershell and so far have been successful with our imaging scripts. Now I am migrating to computer startup and logon scripts.
I have a script that needs to run when the computer boots up and I am setting the new powershell script under Computer Config\Admin Templates\Scripts\Startup under the PowerShell Scripts tab, scripts are set to run first. The script is in the same location the old batch file was located.
Scripts will be ran on Win 10 Ent at boot up.
After updating GPO on a couple test systems, the script does not seem to run, because the changes made are not being applied. I can execute the script from an admin prompt with powershell -executionpolicy bypass myscript.ps1 and it runs fine and all changes are applied.
One, is there a way to catch any errors by redirecting output to a file?
Is there anything else we need to do or check?
Any help appreciated.
Community Chosen Answer
Check out Start-Transcript
But as the automation guy that is writing the scripts... you really should be writing the logs yourself and trapping the errors. Its just bad practice if you are not trapping and dealing with errors.
I'd be careful porting scripts, as you'd just be porting (sometimes) junk across - there might be a new way to action what you require - its a chance to start a new so to speak.
Answered 04/21/2016 by: rileyz
Please log in to comment
log in to commentPlease