Untitled
unknown
plain_text
a year ago
1.1 kB
11
Indexable
$registryPath = "HKLM:\Software\Policies\Microsoft\PassportForWork" $disableName = "DisablePostLogonProvisioning" $enabledName = "Enabled" $desiredDisableValue = 1 # This value disables post-logon provisioning $desiredEnabledValue = 0 # This value disables the feature if (!(Test-Path $registryPath)) { New-Item -Path $registryPath -Force | Out-Null Write-Output "Registry path created: $registryPath" } $currentDisableValue = (Get-ItemProperty -Path $registryPath -Name $disableName -ErrorAction SilentlyContinue).$disableName if ($currentDisableValue -ne $desiredDisableValue) { Set-ItemProperty -Path $registryPath -Name $disableName -Value $desiredDisableValue -Force | Out-Null Write-Output "'$disableName' is now set to disable post-logon provisioning." } else { Write-Output "'$disableName' is already set to disable post-logon provisioning." } $currentEnabledValue = (Get-ItemProperty -Path $registryPath -Name $enabledName -ErrorAction SilentlyContinue).$enabledName if ($currentEnabledValue -ne $desiredEnabledValue) { Set-ItemProperty -Path $registryPath -Name $enabledName -Value $desiredEnabledValue -Force | Out-
Editor is loading...
Leave a Comment