Docschnitzel
Docschnitzel

Reputation: 185

Installing MSU, but get error 'directory name invalid'

I am trying to install a MSU file which is located on a shared drive:

if (([System.Environment]::OSVersion.Version.Major -lt 10) -and ($PSVersionTable.PSVersion.Major -le 3))
{
    $command = "`"" + "Z:\00 - FTA - General\12 - IT\Scripts\Win7 WMF5  KB3134760-x64.msu" + "`""
    $parameters = $command + " /quiet"
    $install = [System.Diagnostics.Process]::Start( "wusa",$parameters,$Username,$Password,"domainName" )
    $install.WaitForExit()
    $install.ExitCode
}

However I get the error message:

Exception calling "Start" with "5" argument(s): "The directory name is invalid" At line:8 char:5 + $install = [System.Diagnostics.Process]::Start( "wusa",$parameter ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : Win32Exception

Anyone here who knows what I'm doing wrong? I also tried replacing the drive letter with the IP, but it yelds the same error message...

\\192.168.254.3\D$\office\00 - FTA - General\12 - IT\Scripts\Win7 WMF5  KB3134760-x64.msu

Upvotes: 0

Views: 233

Answers (1)

henrycarteruk
henrycarteruk

Reputation: 13227

You've over complicated this task, you just need to use the Call Operator (&) to run wusa and pass it the path to the file along with the quiet and norestart options.

$msu = "\\192.168.254.3\D$\office\00 - FTA - General\12 - IT\Scripts\Win7 WMF5  KB3134760-x64.msu"

& wusa $msu /quiet /norestart

Upvotes: 1

Related Questions