hi there,
I setup the GPO to change the Client's registry like the shown below:
# ($_OneDrive = Get-Item -path HKLM:\Software\Policies\Microsoft\OneDrive -ErrorAction SilentlyContinue) -eq $null
if((Test-Path "HKLM:\Software\Policies\Microsoft\OneDrive" -ErrorAction SilentlyContinue) -eq $true)
{
Write-Host $_OneDrive
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
if((Test-Path "HKCR:\CLSID\{04271989-C4D2-689D-E58A-84C94193AFF6}" -ErrorAction SilentlyContinue) -eq $true)
{
Set-ItemProperty -Path "HKCR:\CLSID\{04271989-C4D2-689D-E58A-84C94193AFF6}" -Name ‘(Default)’ -Value "doclib (unclassified)"
}
# if ((Get-ItemProperty “HKLM:\Software\Policies\Microsoft\TESTING” -Name “r1” -ErrorAction SilentlyContinue) -ne $null){
# Set-ItemProperty “HKLM:\Software\Policies\Microsoft\TESTING” -Name “r1” -Value "2020"
# }
# if(($_CLSID = Get-Item -path 'HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}'))
# {
# Write-Host $_CLSID
# }
}
else
{
# Set the location to the registry
Set-Location -Path "HKLM:\Software\Policies\Microsoft"
# Create a new Key
Get-Item -Path "HKLM:\Software\Policies\Microsoft" | New-Item -Name "OneDrive" -Force
# Create new items with values
New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\OneDrive" -Name "SharePointOnPremFrontDoorUrl" -Value "http://win-i1ns5qsofnv:31018" -PropertyType "String" -Force
New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\OneDrive" -Name "SharePointOnPremPrioritization" -Value 1 -PropertyType "DWord" -Force
New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\OneDrive" -Name "SharePointOnPremTenantName" -Value "Contoso" -PropertyType "String" -Force
# Get out of the Registry
Pop-Location
}
this part: always cannot modify the client's registry. does anyone have any idea on it?? Thanks
if((Test-Path "HKCR:\CLSID\{04271989-C4D2-689D-E58A-84C94193AFF6}" -ErrorAction SilentlyContinue) -eq $true)
{
Set-ItemProperty -Path "HKCR:\CLSID\{04271989-C4D2-689D-E58A-84C94193AFF6}" -Name ‘(Default)’ -Value "doclib (unclassified)"
}