I have this function that I would like to pass as a start-job call.
function Write-Registry {
param($RegFileContents, $UserSid)
$TempRegFile = Get-TempRegFilePath
$regFileContents = $regFileContents -replace 'HKEY_CURRENT_USER', "HKEY_USERS$userSid"
$regFileContents | Out-File -FilePath $TempRegFile
$p = Start-Process -FilePath C:Windows
egedit.exe -ArgumentList @('/s', $TempRegFile) -PassThru
do { Start-Sleep -Seconds 1 } while (-not $p.HasExited)
Remove-Item -Path $TempRegFile -Force
}
As of now I call this function using two parameters, which works fine.
Write-Registry -RegFileContents $regFileContents -UserSid $userid
But I'd like to call it as a Start-Job; and can't seem to find how to do it properly.
If someone can help me,
thanks.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…