Category: PowerShell

Collections Are More Transparent In PowerShell v3

In PowerShell version 2, it took me a while to figure out why using the dotted notation method of selecting a property worked at times and not at others. In the following example $v2 is a variable so I'm able to select the CPU property by using $v2.cpu or accomplish the same thing by piping $v2 to Select-Object with the -ExpandProperty parameter and specifying the CPU property: In the scenario shown in the following image, why didn't $v2.cpu return anything? Because it's a collection. In this Read more [...]

Use PowerShell to List Stopped Services that are Set to Start Automatically While Excluding Delayed Start Services

Have you ever had 67 emails about services on your servers being up and down from your monitoring solution? It's not a good feeling and those emails are only about the ones that monitoring is setup for. What other services could be stopped that aren't being monitored? Wouldn't you like a quick and easy way to check whether or not all of the services that are set to start automatically are actually running? My first thought: Use the Get-Service cmdlet. Unfortunately it doesn't have a parameter Read more [...]

Can iSCSI Targets be Renamed on an EqualLogic PS Series Storage Area Network?

I received a tweet from someone a few days ago asking if it was possible to rename an iSCSI target on an EqualLogic PS Series Storage Area Network (SAN). I wasn't sure, but it was interesting enough to research and determine if it was possible or not. Based on a screenshot provided by this person, they wanted to change the default iSCSI target name prefix so new volumes that are created have a different target prefix. It's possible to change this setting using PowerShell, but not the GUI: Even Read more [...]

Want VM Reliability and Uptime? Hyper-V on Server Core

While at TechEd last month I heard two things that I've been preaching for a while. Server Core installation (no-GUI) is the recommended installation type beginning with Windows Server 2012. I've been saying this for a while when it comes to Windows Server 2008 R2. Server Core: Reliability and Uptime In each of three datacenters that I support there are multiple Hyper-V servers that run Windows Server 2008 R2 w/SP1 with the Core Installation (Server Core). These production servers have unbelievable Read more [...]

Use PowerShell to Determine What Roles are Added When Turning a Windows 2012 Server into a Domain Controller

Goal: Determine what roles are installed when turning a Windows Server 2012 machine into a domain controller. I started out by using PowerShell to save a list of what roles are installed on a plain vanilla 2012 server that has the full GUI installation. The following one liner would be used in PowerShell version 2 to accomplish this task and the syntax is compatible with version 3: PowerShell version 3 has simplified syntax when using the Where-Object cmdlet Read more [...]

Welcome to PowerShell Hell

I finally figured out why the error messages in PowerShell are in bright red. It's because it's the color of flames and/or red hot coals and it means you may be in PowerShell Hell. That's what recently happened when I updated the Antivirus on my PC from Eset NOD32 version 4 to version 5. A few days after updating, I was in PowerShell Hell as shown below: When trying to run Get-ChildItem against WSMan:localhost, I received the following: Get-ChildItem : WS-Management cannot process the request. Read more [...]

Places to Learn More About PowerShell at TechEd

Stop by the Scripting Guys booth in the Connect Zone area at Microsoft TechEd North America 2012 to learn more about PowerShell: Here's The Scripting Guy (Ed Wilson) at the Scripting Guys booth yesterday while he was talking about my guest blog on the Hey, Scripting Guys! Blog (displayed on the monitor): Also stop by the Windows Server 2012 Server Manager & PowerShell booth in the Technical Learning Center area: µ Read more [...]

PowerShell 3.0 Hands-On Labs at TechEd 2012

Thinking about learning the new features of PowerShell 3.0 at Microsoft TechEd North America 2012? If you're planning to get some hands on experience using the hands on labs, don't waste your time. I attempted to go through the WSV11-HOL "What's New in Windows PowerShell 3.0 " this morning: Only to find out the resolution (screen size) on the virtual machine is set too high to view the content: I also attempted the WSV12-HOL "Introduction to Windows PowerShell Fundamentals 3.0 ", but had the Read more [...]

Use PowerShell to Audit Logon Authentication Type

Want to know what type of authentication mechanism is being used when users log onto your servers? This script pulls the information from the event logs to determine how users are being authenticated. It uses Get-Winevent with the -FilterXPath parameter. That parameter and what the logon type numeric codes translate to are a couple of things that I haven't seen much documentation on. The script sorts by server name in ascending order and then by the time in descending order. I've Read more [...]

Adding PowerShell Snap-in’s and Locating Added Cmdlets

Want to make the SharePoint 2010 cmdlets available for use from the PowerShell ISE? Some products such as SharePoint 2010 provide their application specific PowerShell cmdlets via a PowerShell snap-in instead of a PowerShell module. The following commands are being run from the PowerShell ISE on a SharePoint 2010 web front-end server. To view the snap-ins that are available to add, run the following: The SharePoint 2010 snap-in is installed on the machine, Read more [...]

Using PowerShell to Find Expiring SSL Certificates & the Websites they’re Associated with

Have you recently received a notification about an expiring SSL certificate and don't remember where all it's used at? It's generally not an issue to figure this out with normal certificates which are issued for a single name, but if it's a wildcard certificate, it could be used on lots of different websites within your organization. The following PowerShell script retrieves all of the SSL certificate's thumbprints and their expiration dates on an individual server that has IIS installed (This has Read more [...]

Using the Quest Active Directory PowerShell Snapin to Search For & Set Attributes

I want to make sure that all users in a specific OU in my mikefrobbins.com Active Directory domain have the "Deny this user permissions to log on to Remote Desktop Session Host server" option set (checked): Download the Quest Active Directory PowerShell Snapin (free). The PowerShell command shown below searches this specific OU in my Active Directory domain for users where this attribute is not equal to false. The default setting is blank (allowed) as shown with the Gill Bates user below. Read more [...]