Files
Scripting/Powershell/From Evernote/Stop organisation asking to manage device win10-11.ps1
2024-02-02 08:54:43 +10:00

11 lines
541 B
PowerShell

#Setting registry key to block AAD Registration to 3rd party tenants.
$RegistryLocation = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WorkplaceJoin\"
$keyname = "BlockAADWorkplaceJoin"
#Test if path exists and create if missing
if (!(Test-Path -Path $RegistryLocation)){
Write-Output "Registry location missing. Creating"
New-Item $RegistryLocation | Out-Null
}
#Force create key with value 1
New-ItemProperty -Path $RegistryLocation -Name $keyname -PropertyType DWord -Value 1 -Force | Out-Null
Write-Output "Registry key set"