'PowerShell script not deploying through Intune, would come back as successful however changes not seen
I have been trying to deploy this PowerShell script to one of my test units however, which involves changing the taskbar layout in Windows 11 through changing the value of certain registry keys. When it does deploy through Intune, it comes back through as successful, however no changes were made. The script also is successful when done manually. There is something that I am missing but I can't figure it out.
$registryPath1 = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search"
$registryPath2 = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$registryPath3 = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$name1 = "SearchboxTaskbarMode"
$name2 = "ShowTaskViewButton"
$name3 = "TaskbarAl"
$value1 = "0"
$value2 = "0"
$value3 = "0"
IF(!(Test-Path $registrypath1))
{
New-Item -Path $registryPath1 -Force | Out-Null
Set-ItemProperty -Path $registryPath1 -Name $name1 -Value $value1 `
}
ELSE {
Set-ItemProperty -Path $registryPath1 -Name $name1 -Value $value1 `
}
IF(!(Test-Path $registryPath2))
{
New-Item -Path $registryPath2 -Force | Out-Null
Set-ItemProperty -Path $registryPath2 -Name $name2 -Value $value2 `
}
ELSE {
Set-ItemProperty -Path $registryPath2 -Name $name2 -Value $value2 `
}
IF(!(Test-Path $registryPath3))
{
New-Item -Path $registryPath3 -Force | Out-Null
Set-ItemProperty -Path $registryPath3 -Name $name3 -Value $value3 `
}
ELSE {
Set-ItemProperty -Path $registryPath3 -Name $name3 -Value $value3 `
}`
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
