PowerShell is a great system management tool, and can help administrators to quickly perform tasks and collect information.
One frustration many users have with PowerShell is, unlike traditional .bat files, .ps1 files will not run by default due to PowerShell's enhanced security. Now this is OK when you’re dealing with a couple of machines, as a quick PowerShell one-liner at the prompt will fix things up for you:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
But, when you're dealing with a large number of machines, and/or you'd prefer to keep PowerShell’s security settings in place, here's a quick workaround. Run the script via a shortcut that temporarily allows the script to run:
From here, you just need to double-click your shortcut to run your script.
Sometimes you won’t want the command window to provide output. For example, say your scripts outputs to a text file. If this is the case, simply add:
Also, if you are using this on machines that could potentially have an altered Powershell profile, you'll likely want to add:
I often use this trick to run .ps1 scripts locally via a USB flashdrive. For each set of scripts that I need to run, I have a shortcut. Then, I just plug in the flashdrive, and double-click the shortcut. This way, you can quickly run scripts locally on multiple machines. Try it out!
Happy PowerShell Shortcutting,