troubleshooting Question

Powershell: keeping all variables in 1 globalvariables.ps1, then load in profile ... but howto exchange these scripts then?

Avatar of janhoedt
janhoedt asked on
Powershell
3 Comments1 Solution76 ViewsLast Modified:
Hi

I'd like to keep all my variables in a GlobalVariables.ps1 which I load in my profile.
All my scripts would then just use $SCCMServer or $SMTPServer instead of full name.

However, this limits the exchange of my scripts, since the scripts won't have the GlobalVariables.ps1.
I could copy GlobalVariables.ps1 to each script I exchange and refer in it via $psscriptroot\globalvariables.ps1 but then I'd need to refer in each of my scripts to this $psscriptroot whereas it is already in my globalvariables.ps1 which is loaded in my profile.
How to address this?

Please advise.
J.
ASKER CERTIFIED SOLUTION
Joshua Grantom
Systems Administrator

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

Top Expert 2014

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 3 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 1 Answer and 3 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