Use PowerShell to Persist Environment Variables

Persistent Environment Variables PowerShell

In PowerShell, you can easily create environment variables using a few different methods. However, these are only scoped to the current PowerShell process, and not to any process running inside the user’s profile, or any process running on the system. Here are a few examples of methods that you can …

Continue reading

Writing Interactive Scripts with PowerShell

If you’re authoring PowerShell scripts that are intended to be interactive, there are a couple of very easy ways to ask your users for input. Typically, user input falls into a couple categories: free-form text input, or a list of pre-defined values. We also might need to prompt the user …

Continue reading

Implementing a .NET Class in PowerShell v5

Introduction You might have heard that PowerShell version 5.0 has introduced support for building .NET classes. Indeed, this is a powerful, new capability that has not previously existed in native PowerShell syntax. Before the new class-building syntax existed, if you wanted to build custom objects in PowerShell, you generally would …

Continue reading

Automating the Lync Client with PowerShell

You love PowerShell, right? And you love the Microsoft .NET Framework? Are you setting out to automate the Microsoft Office 2013 Lync Client with PowerShell? If you answered “yes” to the last three questions, then you’ve come to the right place! We’re going to take a look at how to …

Continue reading

PowerShell: Embed binary data in your script

When writing automation scripts or modules, you might find that you frequently reference external binary data. “Binary data? Well, that accounts for all data!” you might say. Yes, that’s true. But I’m talking about binary data as opposed to files containing simple ASCII or UTF-8 data. Maybe there’s some better …

Continue reading

PowerShell: Tracert or Trace-Route?

UPDATE (2012-07-27): Justin Dearing (@zippy1981) sent me an updated version of the script, which improves on the following: Has some comment-based help Parameter checking Grab it here: Invoke-TraceRoute.ps1 Any network or systems administrator is familiar with the good old tracert.exe utility that’s been included outof-the-box in Windows for years now. …

Continue reading

PowerShell: Twitter Folks

Hey folks, here are some of the top tweeters on the topic of PowerShell! All of them come with my strong recommendation to follow them! You will be in good company, and will probably learn a LOT, if you keep in touch with these ridiculously smart folks. Jeffrey Snover – …

Continue reading

PowerShell: Shortening Web Service Type Names with a Hashtable

When you use the New-WebServiceProxy class, you probably have noticed that PowerShell dynamically generates some really ugly type names. For example, if we get a reference to the Bing web service (you’ll need to get an API key first): $BingSearch = New-WebServiceProxy -Class BingSearch -Uri "http://api.search.live.net/search.wsdl?AppID=$ApiKey" … and examine the …

Continue reading