Powershell Error: A positional parameter cannot be found that accepts argument '='
 
$servers = Import-Csv -Path C:\WinUpVer\Updates08Auto.csv
$servers | ForEach-Object {
	$Server = $_
	"Processing $($Server.ComputerName) ... " | Write-Host -NoNewline -ForegroundColor White
	Try {
		$QFEGroups = Get-WmiObject -Class "Win32_QuickFixEngineering" -ComputerName $Server.ComputerName -ErrorAction Stop |
			Select-Object -Property `
        $QFEGroups = GET-WmiObject win32_operatingsystem ComputerName $Server.ComputerName -ErrorAction Stop |
			Select-Object Name,ServicePackMajorVersion,ServicePackMinorVersion -Property `
				"Description",
				"HotfixID",
				@{Name="InstalledOn"; Expression={([DateTime]($_.InstalledOn)).ToLocalTime()}} |
			Group-Object -Property Description
		$LastHotfix = ($QFEGroups | ? {$_.Name -eq "Hotfix"}).Group | Sort-Object -Property InstalledOn | Select-Object -Last 1
		$LastUpdate = ($QFEGroups | ? {$_.Name -eq "Update"}).Group | Sort-Object -Property InstalledOn | Select-Object -Last 1
        $LastServicePack = ($QFEGroups | ? {$_.Name -eq "SerPack"}).Group | Sort-Object -Property InstalledOn | Select-Object -Last 1
		$LastSecurityUpdate = ($QFEGroups | ? {$_.Name -eq "Security Update"}).Group | Sort-Object -Property InstalledOn | Select-Object -Last 1
        "" | Select-Object -Property `
			@{Name="Computer Name"; Expression={$Server.ComputerName}},
			@{Name="Responsible"; Expression={$Server.Responsible}},
			@{Name="Hotfix"; Expression={$LastHotfix.HotfixID}},
			@{Name="Hot Fix Installed On"; Expression={$LastHotfix.InstalledOn}},
			@{Name="Windows Update"; Expression={$LastUpdate.HotfixID}},
			@{Name="Windows Update Installed On"; Expression={$LastUpdate.InstalledOn}},
			@{Name="Security Update"; Expression={$LastSecurityUpdate.HotfixID}},
			@{Name="Security Update Installed On"; Expression={$LastSecurityUpdate.InstalledOn}},
            @{Name="Service Pack"; Expression={$LastServicePack.InstalledOn}},
			"Error"
		"OK." | Write-Host -ForegroundColor Green
	} Catch {
		$_.Exception.Message | Select-Object -Property `
			@{Name="ComputerName"; Expression={$Server.ComputerName}},
			@{Name="Responsible"; Expression={$Server.Responsible}},
			"Hotfix",
			"HF_InstalledOn",
			"Update",
			"UP_InstalledOn",
			"Security Update",
			"SU_InstalledOn",
			@{Name="Error"; Expression={$_}}
		$_.Exception.Message | Write-Host -ForegroundColor Red
	}
} | Export-Csv -NoTypeInformation -Path "C:\WinUpVer\WinUp08AutoVerify.csv"

I am experincing an error I have tried to resolve with no success. The error is:  A positional parameter cannot be found that accepts argument '='.  Can someone please take a look and suggest a solution.

Thank you.

September 11th, 2015 2:50pm

You have to give us the complete error message.

Free Windows Admin Tool Kit Click here and download it now
September 11th, 2015 3:01pm

Can you give the full error message as it will usually point to the line or part of code that is giving you issues.
September 11th, 2015 3:02pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics