Hi All,
I’m trying to achieve something due by Org policies.
I have the below command, i’m able to manually run it through CMD but when running in user start up (say Run once registry key or through Active setup registry) it is not writing the registry.
I’m not user where the mistake is, can some one guide me. Command line below:
C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -executionpolicy ByPass -command $personal = $env:USERPROFILE; $personal = $personal + “\Documents\Custom Office Templates”; Reg ADD “HKCU\Software\Microsoft\Office\16.0\Word\Options” /v “PersonalTemplates” /d $personal /t REG_SZ /f;
I was told that when there is no console, there could be issue in resolving the environment variables, so i have even tried below and luck
C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -executionpolicy ByPass -command $personal = $(get-itemproperty ‘HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders’).personal;$personal = $personal + ‘\Custom Office Templates’;Reg ADD
"HKCU\Software\Microsoft\Office\16.0\PowerPoint\Options
" /v "PersonalTemplates
" /d $personal /t REG_SZ /f;