Monthly Archives: March 2012

Changing NetBIOS over TCP/IP with Powershell

I needed to re-enable netBIOS over TCP/IP on a set of computers after someone disabled it and broke a system. Powershell was obviously the easiest way to do it!

Here is the code:

$servers = "myserver01", "myserver02", "myserver03", "myserver04", "myserver05", "myserver06"
Foreach ($server in $servers){
  $adapter=(gwmi -computer $server win32_networkadapterconfiguration | where {$_.servicename -like "vmxnet*"})

A value of 1 for settcpipnetbios enables it, and 2 disables it. 0 is to use the DHCP default (from memory).


1 Comment

Filed under Microsoft, Powershell, Windows 2008

Rescan VMware cluster HBA’s via Powershell

Ever wanted to trigger a recsan of storage for all hosts in a given cluster? There may be a reason why you would want to do this via a script rather than a gui and if so, this is it.

I have written it as a function.

The code will connect to a VC, identify the cluster (you give it the cluster name as a parameter), get a list of hosts, and then for each host, trigger a rescan.

Unfortunately, it runs serially, rather than triggering a parallel run. At this stage it doesn’t really matter to me, but at some point, I will write a version that does the rescan’s in parallel.

Function Rescan-ClusterHBA
param ([string]$vmClustername, $viserver)
Connect-VIServer $viserver

$vmClusterPointer = get-cluster $vmClusterName
$vmcluster = $vmClusterPointer | Get-View

$vmhosts = $vmcluster | select -Expand host

foreach ($vmhost in $vmhosts)
	Get-VMHost -Id $vmhost
	Get-VMHostStorage -vmhost (Get-VMHost -Id $vmhost) -RescanAllHba

Leave a comment

Filed under Equallogic, Powershell, VMware