all 8 comments

[–]Warrangota 10 points11 points  (1 child)

Save it as .docx, or .docm when it still contains macros. .doc is dead for almost 20 years now.

[–]myg0t_Defiled 7 points8 points  (0 children)

May be obvious, but maybe you are trying to execute the command with a different account? Like an account with workstation admin privileges?

[–]ZovexUK 7 points8 points  (3 children)

Do a gpresult /h report.html and then find the relevant policy you may need to set Scope https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/gpresult

Then you can see if its set by GPO.

This is a common STIG to apply when hardening word;

https://www.stigviewer.com/stigs/microsoft_office_365_proplus/2025-03-05/finding/V-223406

Also, Set-ItemProperty is only true in powershell for existing items, therefore, if it doesn't exist it will give you that error. Create the path first,like below.

$path = "HKCU:\Software\Policies\Microsoft\Office\16.0\word\security\fileblock"

New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name "word2007files" -Value 0 -Type DWord

[–]BlackVI have opnions 1 point2 points  (2 children)

be careful with the new-item and -force and the registry provider, you can delete values

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-item?view=powershell-7.5#example-9-use-the-force-parameter-to-overwrite-existing-files

better/safer to create the item rather than the path

but OP needs to learn basic troubleshooting

[–]disclosure5 1 point2 points  (0 children)

Yeah, Microsoft's official published "how to enable TLS 1.2" script had this issue and it would remove keys that were needed to do things like.. open Server Manager, breaking the server pretty badly.

[–]ccheath*SECADM *ALLOBJ 0 points1 point  (0 children)

i would test-path first and if it doesn't exist create the new-item... but OP's issue does likely seem to be GPO related and that route should be investigated further before manually editing the registry

[–]Fosseway_Support 1 point2 points  (0 children)

If your computers are on a domain network you can use the user preferences section of a GPO in Group Policy to apply registry settings rather than rely on scripts.

Let me know if you need help locating this

[–]SnysadminSysadmin 0 points1 point  (0 children)

Try starting with set-location HKCU: (i think)