Hello I’m a Mac

So today is my last day at Citrix.  Over the past month or so I’ve been interviewing with Apple’s iPhone team and have accepted a position on the Wireless Technologies team.  My official title is “Tools/Automation QA Engineer”, which basically means I’ll be writing software to test the iPhone’s Bluetooth and WiFi features.  I’m pretty excited about the opportunity, after all I get to work on the world’s best phone and live in one of the greatest cities.  But there’s a lot that needs to happen in these next couple of weeks.

San Francisco from Coit TowerMy first day on the job is July 27, a little less than two weeks away.  In about a week the movers will ship all of my stuff out west and I’ll be jumping on a plane shortly after.  I’ll be staying in temporary housing till I can find a place in San Francisco, hopefully this wont take long.  I really can’t imagine what this experience would be like without the help of the relocation staff.

So between getting ready for the move and enjoying my last few days in the warm Atlantic Ocean, I plan on spending some time on NetPoint.  It’s a bit aggressive, but I’m going to try get the NetPoint v2.5.1 update online and give the Neutex web site a facelift.  The v2.5.1 update will have some bug fixes and basic integration with OneOrZero’s help desk system.  As far as the web site goes, I think there are a few things that can be done to help market NetPoint better.  I anticipate the first month or two at Apple will be crazy, so finishing this before I head out to the valley will definitely save me some grey hair.

As far as Shannon Ma Virtualized goes, you probably wont see much new content on XenApp.  However, I still plan on developing tools like NetPoint that will alleviate some of the common problems IT Pros face and you can be the first to hear about them here.  I also have some other ideas for topics that I need to look into a bit more, so we’ll see how that pans out.

Episode 1 of the NetPoint PowerShell Commands

Back in March I wrote a blog about the NetPoint PowerShell Commands, which are now available in NetPoint 2.5. These commands can be used to query your network inventory from PowerShell, so you can easily automate those repetitive system and asset management tasks.

Within the upcoming week or two, I plan on posting a set of videos that will show how these cmdlets can be used to automate some typical IT scenarios.  This first episode gives a brief introduction of the NetPoint PowerShell Commands.  We also walk-through a scenario that involves getting a list of the programs installed on an arbitrary machine in just one line of script.

In the next episode, we’ll look at generating custom network inventory reports right from PowerShell, so stay tuned!

PowerShell Cmdlets for Network Inventory

This past week I spent a few evenings on my balcony coding the final bits of Project Full Moon.  Full Moon is a set of PowerShell Cmdlets for NetPoint, which are targeted at helping IT Pros automate repetitive system and asset management tasks.

In this post I’ll show how you can use these commands to make your life a bit easier.  Here are some scenarios I’ll walk through:

  • You’re interested in getting a list of the apps installed on a certain system
  • Some of your Dell workstations are having issues with their NVIDIA graphics cards.  You need to apply a driver update to all of these systems.
  • It’s that time of the year to buy new hardware.  You need to determine if there are any systems that need a hard drive upgrade.
  • There’s a new virus in the wild.  You need to ensure all of your systems are protected with up to date virus definitions.

So let’s get started!  First let’s add the NetPoint PowerShell SnapIn and get a list of our network inventory cmdlets:

Add-PSSnapin Neutex*
Get-Command -PSSnapin Neutex*

PowerShell will list the 20 cmdlets available to us:

  • Get-NetAntiVirus
  • Get-NetBIOS
  • Get-NetCDROMDrive
  • Get-NetDiskDrive
  • Get-NetFirewall
  • Get-NetFloppyDrive
  • Get-NetLogicalDisk
  • Get-NetMemory
  • Get-NetModem
  • Get-NetMonitor
  • Get-NetNetworkAdapter
  • Get-NetOperatingSystem
  • Get-NetPatch
  • Get-NetPrinter
  • Get-NetProcessor
  • Get-NetProgram
  • Get-NetService
  • Get-NetSoundDevice
  • Get-NetSystem
  • Get-NetVideoController

Now we're ready to tackle our scenarios.

You're interested in getting a list of the apps installed on a certain system

Get-NetProgram can be used to retrieve a set of programs.  Running this command by itself will return all programs that have been installed on our network (even those that have been uninstalled).  Like all of our other network inventory commands, it also accepts a set of parameters (app name, publisher, how often it's used, etc.) that can be used to filter its results.  Here is the script that will get us the results we want:

Get-NetProgram -System maui -Uninstalled $False | % { $_.DisplayName } | sort -unique

This command starts out by retrieving all of the apps installed on the system named maui.  By default, we’ll get a whole set of information about each app, but we only want the app names so we’ll pipe this into % { $_.DisplayName } and sort it so we can easily get an idea of the installed apps.

Some of your Dell workstations are having issues with their NVIDIA graphics cards.  You need to apply a driver update to all of these systems.

The data we need to target for this scenario is spread across two domains: video controller (NVIDIA graphics cards) and system (Dell workstations).  We’ll use Get-VideoController in conjunction with Get-System to get the job done:

Get-NetVideoController -Name nvidia* -Uninstalled $False | Get-NetSystem -Manufacturer dell* | % { $_.ComputerSystemName } | sort -unique

Here we’re getting a list of all installed graphics cards whose name starts with NVIDIA.  We then pipe this to Get-System with the Manufacturer parameter set.  This will return all Dell systems that contain an NVIDIA graphics cards.  The last two portions of this script will cause only the system names to be returned in alphabetical order.

You could use this output with the WMI cmdlets to install the driver update.

It’s that time of the year to buy new hardware.  You need to determine if there are any systems that need a hard drive upgrade.

In this scenario, we’re interested in using the Get-NetLogicalDisk cmdlet as follows:

Get-NetLogicalDisk -DriveType "Local Disk" | where { $_.FreeSpace / $_.Size -lt .10 } | % { $_.ComputerSystemName }

The first portion of this script will get all partitions that are stored on hard disks (versus CDs, floppies, etc.).  We proceed by using PowerShell’s where command to only get partitions that have less than 10% of free space and we pipe this to % { $_.ComputerSystemName } to only get a list of the system names.

There’s a new virus in the wild.  You need to ensure all of your systems are protected with up to date virus definitions.

This scenario is a little more complex than the previous ones, however we can still solve it in two lines of PowerShell.

$i = Get-NetAntiVirus -Uninstalled $False -UptoDate $True | % { $_.ComputerSystemName } | sort -unique
Get-NetSystem | where {$i -notcontains $_.ComputerSystemName} | % { $_.ComputerSystemName } | sort -unique

The first line will get us names of all the systems that have an antivirus client with up to date virus definitions.  The second line will subtract this list from all of the systems on our network using the where command, which leaves us with the unprotected systems.  The WMI cmdlets could also be used here to install an updated antivirus client on these systems.

That pretty much sums up some of the basic scenarios you can address with NetPoint’s PowerShell Cmdlets.  There is some documentation work that still needs to be sorted out, however you can expect to see the final bits online in a couple of weeks.  In the meantime if you don’t already have a copy of NetPoint, you can get the free Express Edition here.

Follow

Get every new post delivered to your Inbox.