Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param([Int32]$value=0)
- $registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System"
- $Name = "DisableLockWorkstation"
- IF(!(Test-Path $registryPath))
- {
- Write-Host "Cannot change the status as the key cannot be found"
- }
- ELSE
- {
- if ($value -ne 0 -and $value -ne 1)
- {
- Write-Host "Invalid parameter passed"
- }
- else
- {
- #The value is actually the reverse (which makes it counter-intuitive) so reverse it
- if ($value -eq 1)
- {
- $value = 0
- }
- else
- {
- $value = 1
- }
- Write-Host $value
- Write-Host $registryPath
- New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
- if($value -eq 0)
- {
- Write-Host "Windows+L lock enabled"
- }
- else
- {
- Write-Host "Windows+L lock disabled"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement