Zoho Banner September 2011

Archive for April, 2011

Here’s a little WMI script I threw together the other day to help someone out.  The requirement was to set the display name (label) of a network adapter based on its hardware location.

Let’s say we have a NIC with the display name “Local Area Connection” and you want to change it to “MyNIC”, but only if it has a specific hardware location (e.g. PCI bus 3, device 0, function 0).  Of course, you can do this manually by nipping into the network connection properties (ncpa.cpl), but what if you have tens or hundreds of servers that you want to do this for?

nic_details_before.jpg

nic_configure.jpg

######################################################### 
# 
# Name: SetNetConnectionID.ps1 
# Author: Tony Murray 
# Version: 1.0 
# Date: 20/04/2011 
# Comment: PowerShell script to 
# change device display name for network adapter based 
# on hardware location 
# 
######################################################### 
$newname = "MyNIC" 
$location = "PCI bus 3, device 0, function 0" 
$drvinfo = (Get-WMIObject Win32_PnPSignedDriver `
| ?{$_.Location -eq $location}).DeviceID 
$nic = Get-WMIObject Win32_NetworkAdapter `
| ?{$_.PNPDeviceID -eq $drvinfo} 
$oldname = $nic.NetConnectionID 
write-host "Network Adapter name before change: " $oldname 
$nic.NetConnectionID = $newname 
$nic.Put()

After running the script, you should see that the display name has changed.

nic_details_after.jpg

My script only changes the NIC display name for the computer on which it is running, but you could easily change this to run against multiple machines.

If you’re looking for a Global Address List synchronisation solution for Exchange that simply uses Powershell, look no further than this excellent script from fellow MVP Carol Wapshere.

http://www.wapshere.com/missmiis/a-galsync-powershell-script

The script doesn’t leverage the DirSync control (and hence doesn’t use deltas), which means that it isn’t perhaps as efficient as some of the full-blown solutions out there, but it has the beauty of simplicity!  Another advantage is that it doesn’t require any expensive infrastructure components – unlike most solutions that need at least one dedicated server and a database.

It also works with a variety of Exchange versions!

The script is likely to be most useful for SMEs during migration scenarios. Larger organisations or those looking for something long-term are more likely to invest in a more comprehensive solution such as FIM, SimpleSync or Quest ActiveRoles QuickConnect.

I encourage you to check it out.