troubleshooting Question

"Bootstrapping" powershell scripts

Avatar of hypercube
hypercubeFlag for United States of America asked on
8 Comments2 Solutions822 ViewsLast Modified:
I'm trying to set up all the necessary WMI settings for monitoring a workstation by running a local powershell script.
It's going pretty well.  I'm at the stage where it's about ready for production.

Remaining to solve:
I have all the files on a file share and can copy and import modules from there.  
But the workstations aren't set to run scripts.  So I need to first set them up for "unrestricted" as none of my scripts are signed.
(Then I can set them back to "undefined" when I'm finished).
Ideally, I think I'd want to do everything from a single command or desktop shortcut.
(This must be a fairly typical objective).

So how might you suggest I do that?
Right now I have to run some powershell commands to get things started.
While *I* can do that, it's more tedious and not so "exportable" to others.

For example:
Set-ExecutionPolicy Unrestricted
         (and respond "A")
Copy "\\server\c\\Scripts\MyScript.ps1" "$($Env:Temp)"
Import-Module "$($Env:Temp)\MyScript.ps1"

How to fire off all 3 commands without having to type them all and give a response as well?
A simple one-liner would be great!
Subash Sundharan
IT Infrastructure Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros