PowerShell to Configure iSCSI and MPIO

At work we have started to make a push to get as many servers off of RDM (Raw Device Mapping) drives in the virtual environment as we can. We use the RDM drives with MSCS (Microsoft Server Cluster Service) with SQL, but we do have a few application failover cluster as well. With this change we have an influx of iSCSI (Internet Small Computer Systems Interface) drive configurations along with  MPIO (Multipath I/O) configured.  … Continue reading

Loading Modules from Remote Server with PowerShell

Have you ever found yourself trying to run a command, and found out that you need to have modules loaded that are only installed on a remote server. I know I have many times, and trying to found the right module to download at times is nearly impossible.

So starting with PowerShell version 3.0, there is a now way to import a module from a remote machine.  … Continue reading

Issues with PowerShell Modules and Duplicate Cmdlets

At the end of the day I always take my laptop with me as I never know when I’ll get a call about server issues.  So my PowerShell sessions remain open all of the time, with all of the modules loaded.  Granted I do save my scripts that I work on frequently, and I had a problem before losing a few scripts without having a recent save.  … Continue reading

Using PowerShell to work with SSL Certificates

At my office we have a certificate renewal process that happens every other year.  This year, we have a plan to document the location of all of the certificates that are installed on the servers to help the next time the renewal happens.  So I have worked out a quick and simply one liner that will get all of the certificates installed on the server in the LOCALMACHINE\My certificate store.… Continue reading

Installing PowerShell on Linux Ubuntu

Now that Microsoft has made PowerShell open source it can be installed on Mac OS X and Linux.  In this article I’ll discuss the steps on installing it on Linux Ubuntu.

PowerShell on Linux
PowerShell on Linux

Step 1 – Download the package

As  seen in the image above, I have the newest distro of Ubuntu.  The first step into getting PowerShell installed is downloading the package from Github as it hasn’t been added to any of the repositories yet.… Continue reading

Find Registry Keys on Remote Servers

I was tasked with writing a script to find a single registry key on all of the server for a domain that my team manages. So after getting the key that we need to know the value of, I put a script together. The script will first check to see if the server is online, and if it is then the scripts looks at the registry to find the key and records the value.  … Continue reading

Revisiting the PowerShell Profile

I’ve posted about the PowerShell profile before but I didn’t really go in depth on it, so I wanted to revisit the subject to make sure that I address some of the points that I may have missed.

To find your PowerShell profile location, you can use PowerShell to list it.

Get-ChildItem $profile

This will bring back the directory %UserProfile%\Documents\WindowsPowerShell.  … Continue reading

Using PowerShell Desired State Configuration (DSC)

I’m just starting to scratch the surface with Windows PowerShell Desired State Configuration (DSC). This seems to be the proper way to accurately configure multiple servers with the identical configuration. Using DSC (Desired State Configuration) to configure servers is as simple as generating a base template that you want to use to setup the servers, and then run it against a list or single server.… Continue reading

How to setup a PowerShell profile and load the PowerCLI Snapin.

My PowerShell profile has been the most used script that I have wrote, and its not really a script.  The PowerShell profile runs every time that PowerShell ISE is opened. With this profile you can customize it to your needs.  It can load frequently used snap ins, functions or even custom properties.  When I help others with scripts, I forget that not everybody has a PowerShell profile setup and customized like myself.… Continue reading

How to verify windows features match with PowerShell.

In the last couple of weeks I had to configure several servers that needed to be the same as in a lower environment.  So instead of just guessing what i installed several months ago, I wrote a script to do it for me.

$OriginalServer = "Server_Name"

#Gets the windows features installed on the original server and stores it as $ComputerA_WindowsFeatures
$ComputerA_WindowsFeatures = (Get-WindowsFeature -ComputerName $OriginalServer | Where {$_.Installed -eq "True"}).Name

#Gets the windows features installed on the system you are currently logon that needs to match the original server and stores it as $ComputerB_WindowsFeatures
$ComputerB_WindowsFeatures = (Get-WindowsFeature | Where {$_.Installed -eq "True"}).Name

#Compares the 2 variables and stores the differences as $difference
$difference = (Compare-Object -ReferenceObject $ComputerA_WindowsFeatures -DifferenceObject $ComputerB_WindowsFeatures).inputobject

#Installed all of the features that are stored in the $difference variable.
Continue reading