Today I just wanted to write a quick note about how to authenticate to a proxy within a Powershell script. Most corporate networks have proxies, and most also require authentication. The problem is, if you try to connect to any Internet resource, such as installing a Powershell module via the Install-Module command or downloading a file or other info from a website, you may see something like this: Continue reading
Getting IP Network Information with Powershell
Those of us that have tried to manipulate IPv4 information in Powershell know that out of the box, it isn’t the easiest thing to do. Problem is that in calculating IPv4 information such as broadcast address, network address, and host range properly, you have to manipulate it in it’s 32-bit form, and not its integer format.
After having to do this the hard way a few times, I decided to write a script that I could use for a wide array of scenarios to get this information, and now I’m passing the time savings onto you! Continue reading
Run Script or Command as Admin in Powershell
A coworker of mine was writing a script to simplify some configuration items on some servers, and he ran into a snag. If you’ve worked in IT for at least a day, you’ve seen this message at some point:
This is easily solved using the old right-click -> Run as Administrator routine, but what if you need a script to run a command, or an entire script as administrator? In this post I go through the three scenarios I’ve come across for running some Powershell commands as an administrator; a single command, an entire .ps1 or batch file, and a entire script from within the script calling it.
Convert Julian Date to Gregorian Date in Powershell
So the other day I was presented with the issue of converting a Julian Date (YYYYDDD) to a Gregorian Date (MMDDYYYY). After a few minutes in Powershell I realized that there was no built in way to do this. A few minutes a Googling yielded a few long, bloated scripts. I knew there had to be a better way, and there is!
Working with Scheduled Tasks in Powershell on Windows Server 2008
Windows Server 2012 / Windows 8 and above include some nifty Powershell cmdlets for working with scheduled tasks. However, when the need arises to programmatically work with them on older OS versions, mainly Windows Server 2008 , try out the code below.
Testing For an Array in Powershell
I’ve seen lots of methods for checking whether or not a variable in Powershell contains an array. All of them work, so really it comes down to which one is the easiest. Some cmdlets and constructs will error out if you treat them like an array, or more commonly, produce unexpected results. Here are the two methods I’ve used for this over the years, I’ll let you be the judge of which one is the easiest.
Upgrading to Raspian (Jessie) on Raspberry Pi
So you’ve just gotten your new, shiny Raspberry Pi, and you’re installed Raspbian on it. Raspbian installed with NOOBS (New Out of Box Software) is a version called “Wheezy”, which as some of you may know, is not the latest and greatest release. If you need help installing Raspbian, the Raspberry Pi Foundation has a great how-to here. But if you’re ready to go, upgrade to Raspbian Jessie with these steps.
Debugging Powershell Scripts for Orchestrator 2012
Let me start by saying I love Powershell. It’s a extremely powerful and strangely fun language to code with that can make virtually any aspect of my day faster and easier. Along those same lines I love Orchestrator, because it can take those tasks and automate them. You can even integrate your runbooks with something like Service Manager Self Service Portal to offer delegation of your automated tasks to other users so you don’t spend your day running reports off of scripts you wrote or some other tedious task.
With all of that being said, writing Powershell scripts that work as expected with Orchestrator can be a pain, unless you’re running a 32-bit Windows 7 machine, more on that later.
Lync Server 2010 – Edge Server Issue with KB2982385
Microsoft released a bunch of patches this last patch Tuesday, one of which was an update to Lync Server, KB2982385, meant to address a security vulnerability that could allow a possible Denial of Service attack. More info on the vulnerability is available on Technet. I know some people have had an issue applying this patch and with any luck this post can save you a bit of time.
Internet Slowdown Day
Today is Internet Slowdown Day, the day where Internet users, big tech companies, and those that are in between things to believe in band together to fight the ever-present threat against Net Neutrality. Some of the biggest tech companies around such as Netflix, Mozilla, and Reddit are banding together to get the word out that the changes currently being discussed at the FCC can have real consequences unless we all do something about it and make our voices heard.