Monday, April 7, 2014

PowerShell 002


Another day-in-the-life type post. We have all been there; systems engineers, developers, hobbyists, tinkers or the like finding ourselves troubleshooting network issues. And the first thing we do? Anyone? PING. Right? We all head to PING or IPConfig or some basic tool and we ‘PING’ something to begin figuring out why we can’t connect or why our connection is wonky. Yes, ‘wonky’ is a real word and completely acceptable.

OK, but wait. PING? Isn’t that a command my Grandfather taught me? That is so old school. I’m modern, cool, wicked smaht (as we say in Boston), there has to be something better than PING; PathPing? Tracert? Not bad. Interesting command line tools, but still old-school. I want PowerShell, how can I do this in PowerShell?


I will try to use this as a theme. Introduce a bit about the PowerShell help system in every post. It is so very cool and well worth the time. ‘Teach a man to fish’ and all that!
So the goal here is to navigate through and look at issue with your network connection. Open  the PowerShell ISE or Console, your choice (choose ISE) and enter:
PS C:\> get-help network

Hit Enter and you will get a list of far too many options. OK, time to narrow down. How about:
PS C:\> get-help connection

Still too many results. VPNClient stuff, SMBShare stuff, Hyper-V, lots of interesting things but not what I want. Wait, I can use wildcards can’t I? Wildcards are your savior when trying to figure out things in PowerShell. Enter this:
PS C:\> get-help *connect*

The list is still  long but take a look at some of the info in the ‘synopsis’ column. A quick scan and you will see  “…ICMP echo… blah blah” that sounds an awful lot like PING. Let’s check it out. The cmdlet is called Test-Connection. Now go to the source, type the following and read through the output.
PS C:\> Get-Help Test-Connection -Full

Take a look at the –ComputerName parameter. The syntax of the parameter looks like this:
-ComputerName <String[]>

The square after String tell you that you can have multiple inputs, separated by a comma so this will work great!
PS C:\> Test-Connection -ComputerName srv1, file01 


The  benefit to this cmdlet over PING is that it is machine independent. It can  work with multiple machines at a time and provide heuristics about connections between two remote hosts. From the Help file you can see all of the available parameters, and since you used the –Full switch, some practical examples of how to use the cmdlet are shown at the bottom.
Let’s keep this introduction to Test-Connection simple. We will only cover a few of the parameters, -ComputerName, -Count and –Source.


This is a positional parameter and it is required. This means you must state what host you wish to test with (I almost said PING <g>), but if you place the computer name immediately after Test-Connection,you do not need to specify the parameter name. For a best practice leave it in there. It makes reading PS info much easier later as you begin sharing with colleagues, friends, family and whoever is still listening to you J. These two statements are the same:
PS C:\> Test-Connection -ComputerName srv1
PS C:\> Test-Connection srv1

If you need to test the connection to multiple machines at a time. separate the machines names with a comma.
PS C:\> Test-Connection -ComputerName srv1, file01


This switch  tells the cmdlet how many echo requests to send. Similar to PING it defaults to 4 but if you are looking at a connection and need to keep it going as you do something you can crank this up.
PS C:\> Test-Connection -ComputerName srv1 -Count 10


This one IMO is very powerful. This allows you to sit at your computer and  test a connection between two remote systems. Imagine you are troubleshooting an n tiered app and some performance issues. You can use this to quickly determine ICMP issues or network latency issues between any two nodes in your application design. Finding where a slowness is occurring can help you narrow down where to dig deeper.

PS C:\> Test-Connection -ComputerName srv1, file01 -Count 5 -Source dc1

This cmdlet with PING srv1 and file01 5 times from dc1.

Source Destination IPV4Address    IPV6Address Bytes Time(ms)
------ ----------- -----------    ----------- ----- --------
DC1    file01              32    0      
DC1    srv1             32    0      
DC1    file01              32    0      
DC1    srv1             32    0      
DC1    file01              32    0      
DC1    srv1             32    0      

Look deeper into the help files, if you are into WMI and building really powerful scripts and automation, this cmdlet returns a WMI object called Win32_PingStatus object that you can use for some amazing things. 

Kevin Sullivan, Director of Sales Engineering

Friday, March 28, 2014

My new favorite PowerShell cmdlet

OK, maybe not my favorite, and maybe I need to get out more but the more I learn about PowerShell the more excited I get. It is actually fun, not kidding. It’s reminiscent of that feeling I had 30 years ago when troubleshooting my first BBS or first code. These are my two favorites right now. But these are subject to change!


After listening to Jeffrey Snover –Microsoft Distinguished Engineer and God Father of PowerShell, Don Jones, author or ‘PowerShell in a Month of Lunches’, and other PowerShell MVPs the most important aspect of PowerShell is the help system. Learning to use it is essential to mastering PowerShell. In using the help system and simply playing around, you will easily figure out how to perform menial tasks simply and more efficiently. So let’s get to know the help system.
Here is a good start. Open the PowerShell Console Application ‘as administrator’. This is important because if you run the PowerShell Apps (Console or ISE) as Administrator to get the most bang for your buck. Run the following command

PS c:\ Update-help

The system begins with no help information. You have to update the help system to get started.
Next choose a command you want to work with. This makes for a nice transition into the second cmdlet we will talk about, Get-EventLog.

PS c:\ Get-Help Get-EventLog –Full

Make sure to use the –Full switch as it will ensure all of the interesting info is present. Look around, learn the cmdlet, play a bit and see what you find.
What I found is how to use my favorite cmdlet to troubleshoot any issues related to deployment, or pretty much anything else my imagination can come up with.


By using the Help system you will begin to better understand PS syntax, positional parameters, mandatory parameters, what can be piped into other cmdlets, what can’t and lots more. When learning the Get-EventLog cmdlet and playing around I began thinking of one of the most basic troubleshooting tasks we perform typically manually.

How often, when troubleshooting do we open the event viewer to look for issues and hints to what is happening? Often, very often. Then you switch to another machine and look at the event logs over there, in event viewer. Next you go back to the first machine because you can’t remember what you read in the first place… fun times! No more. I’ll share these parameters one at a time to show how powerful this actually is.


PS c:\ Get-EventLog –LogName <string>

The –LogName parameter is what is called positional and mandatory, and it takes a string. The string is the name of the Windows Log. You don’t even have to use –LogName as long as you explicitly call out the name of the actual log you are looking for so in this example I could have written;

PS c:\ Get-EventLog Application

I’m going to leave the –LogName parameter in my examples to make sure they are as explicit as possible.


This one is pretty self-explanatory. The –ComputerName paramater allows you to explicitly call out the name of the machine(s) you want to query for their event logs. For multiple machines separate the names with a comma,

PS c:\ Get-EventLog –LogName Application –ComputerName srv1, srv2, srv3

Now my command will reach across the wire to machine called srv1, srv2 and srv3 and grab the contents of the Application log! Awesome! For the rest of the examples I will just look at srv1.


OK, so no one wants to grab the entire contents of the windows log and output that to a screen. It is way too noisy. The –Newest parameter allows you to specify how many of the most recent events you want to grab.
PS c:\ Get-EventLog –LogName Application –ComputerName srv1 –Newest 20

I know, the line is getting longer but look how intuitive this is. Amazing.


Source essentially specifies where the events actually come from. So in my environment I want to see if anything interesting is happening wrt Specops Product. Srv1 is my Specops Deploy Server in this case.

PS c:\ Get-EventLog –LogName Application –ComputerName srv1 –Newest 20 –Source *Spec*Depl*

Did I forget to tell you the –Source parameter (and –Message and others) take Wildcards? What? That is amazing! Why yes it is. So when I run this command I don’t leave my desk, I grab all pertinent events from remote system on the fly to help troubleshoot and get to know my environment. That above command may wrap by the way… but you get it.
Here is the console output.

Play around with this. Use Get-Help, learn the syntax. It is fun and has a huge impact on how much time you spend on repetitive tasks. And it is so much more intuitive than VBScript or Kix or any other attempt at providing a shell or automation to Windows. There is so much more you can do, pipe results to a file or a web page!, run against multiple machines at a time, format the output, only output errors, or warnings, endless possibilities.

Enjoy playing!

Kevin Sullivan, Director of Sales Engineering

Friday, March 21, 2014

Optimal screen resolution for new OS deployments

We were recently contacted by a customer who was experiencing a strange issue. When they performed a new deployment the screen resolution switched back the default of 1024x768. What they wanted was the optimal screen resolution to be detected for different machines. The solution was an easy fixed thanks to Specops Deploy.  

There are many scenarios where variables can be utilized. In this post I’ll cover the screen resolution scenario and a couple of more.

Optimal screen resolution
Once your GPO is configured for all of the basic information, follow the steps below to enable the auto-detect behavior for optimal screen resolution.

1. In the Group Policy Object Editor navigate to the Specops Deploy OS node and click ‘Edit Policy’
2. On the Custom MDT Properties tab click ‘Add’
3. Add the following variable and associated values
4. Done!

Additional ideas

Enable BitLocker step-by-step
1. Enable the following Administrative Template settings

 2. Navigate to the Specops OS Deploy node and Edit Policy

 3. On the customer MDT properties tab click "Add"
 4. Add the following Variables

For more information on enabling BitLocker check out Deploying BitLocker Protected Workstation Using Specops Deploy/OS on Oscar Virot is a consultant at Knowledge Factory. Thanks Oscar!

HideShell is used to hide explorer.exe during installation. Keeps curious fingers off the machine as it is deploying! This one can create some interesting challenges during troubleshooting sessions. Use at your own risk and be careful out there! Homepage is pretty self-explanatory.

Enjoy and please share interesting scenarios where you use Custom MDT Properties!

Kevin Sullivan, Director of Sales Engineering

Friday, February 14, 2014

Error after capturing Windows 7x86

If you install a client machine from a Windows 7 x86 DVD and follow all of the default options during the installation, you will most likely experience an issue while capturing that client with Specops Deploy. After Specops Deploy runs Sysprep and reboots, chances are that your client machine will freeze when windows is loading files.
The freezing occurs because a 100 MB system partition was created  during the operating system installation. The creation of the system partition occurs if the default options are used when installing the operating system from the Windows 7 x86 DVD. If you look in disk management you would see both the system partition and the C:OS partition. 

There are a few ways you can workaround the issue of the system partition causing the capture to fail. The first is my recommended workaround. This would be to deploy the source files from Specops Deploy to the machine that you want to capture instead of using a Windows DVD to install the operating system. If you do this, you will not get the system partition and not have the issue. The second workaround, if you do need to use the DVD to install the operating system, would be to remove the system partition before you do the capture and make sure the the operating system partition is bootable. Terabyte provides the steps on how to do with on an MBR. has a detailed set of instructions on how to prevent the creations of a hidden system partition during installation of windows.

Once the system partition is removed and the OS Partition is bootable, go ahead and start your capture again. For more information on best practices suggested by Specops for capturing images, check out my colleague Mikael’s blog article on Keeping your Corporate Golden Image Golden. It is important to follow the recommended best practices from the Specops Product Specialists so that you can efficiently create the best captured images for your environment. 

Happy Deployments! 
 Heather Pacan, Product Specialist

Friday, February 7, 2014

Specops Deploy 5.0 now available

The latest release of Specops Deploy makes it possible to deploy applications and operating systems to Windows tablets. Find out more about Specops Deploy 5.0