PSWindowsUpdate icon indicating copy to clipboard operation
PSWindowsUpdate copied to clipboard

Invoke-WUJob with splat throws error.

Open SunsparcSolaris opened this issue 11 months ago • 1 comments

$WUJobSplat = @{
		TaskName = "PSWindowsUpdate"
		Confirm = $False
		Verbose = $True
		Script = 'Import-Module PSWindowsUpdate; Install-WindowsUpdate -AcceptAll -NotCategory "Drivers" -IgnoreReboot'
	}
	If ($TriggerDate -eq "Now") {
		$WUJobSplat.Add("RunNow", "1")
	} Else {
		$WUJobSplat.Add("TriggerDate", $TriggerDate)
		$WuJobSplat.Add("EndBoundary", $($TriggerDate).AddHours(5))
	}

Invoke-WUJob @WUJobSplat

A positional parameter cannot be found that accepts argument '$null'. + CategoryInfo : InvalidArgument: (:) [Invoke-WUJob], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,PSWindowsUpdate.InvokeWUJob + PSComputerName : REDACTED

SunsparcSolaris avatar Feb 13 '25 00:02 SunsparcSolaris