Tag Archives: powershell

Adding drivers to a Windows 8.1 install.wim file

I have a Windows 8.1 Enterprise image (32-bit) and wanted to install the vendor specific (Dell) drivers into it, so I can use the image on a new device without having to manually faff around loading them separately. I downloaded the driver cab (5830-win8.1-A00-9Y5Y5.CAB) and attempted to run it on a Windows 8 (8.0) PC without any luck. 

I did the following:

  1. Open Powershell with Administrator rights.
  2. Made a folder called c:\image
  3. Made a folder called c:\drivers and copied the contents of the CAB to that location
  4. Ran “mount-windowsimage -path c:\image -imagepath e:\sources\install.wim -index 1”
  5. Ran “add-windowsdriver -path c:\image -driver .\drivers”


At that point it falls over with errors like the following:

add-windowsdriver : DismOpenSession failed. Error code = 0xc0000135

At line:1 char:1
+ add-windowsdriver -path c:\images -driver c:\drivers -logpath c:\log\drivers …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:)[Add-WindowsDriver], COMException

+ FullyQualifiedErrorId : Microsoft.Dism.Commands.AddWindowsDriverCommand


The solution? ou need a Windows 8.1 machine to modify the image (not 8.0), and instead of the CAB file, I used the extracted contents of the .EXE files:


Of course, I will need to wait until I actually get the tablet to test, but at least the Windows image appears to incorporate the drivers correctly.

Leave a comment

Filed under Uncategorized

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