Skip to content

Instantly share code, notes, and snippets.

@Purp1eW0lf
Created March 15, 2023 20:00
Show Gist options
  • Select an option

  • Save Purp1eW0lf/ef9371d317e268d40a769d143128652a to your computer and use it in GitHub Desktop.

Select an option

Save Purp1eW0lf/ef9371d317e268d40a769d143128652a to your computer and use it in GitHub Desktop.
#Run as Administrator, copy/paste the below
# Mount HKU
mount -PSProvider Registry -Name HKU -Root HKEY_USERS;
# Loop through each HKU/user's HKCU, AND deploy OneNote defences
(gci -path "HKU:\*\Software\Microsoft\Office\*\OneNote\Options\").PsPath |
Foreach-Object {New-ItemProperty -Path $_ -Name "disableembeddedfiles" -Value 1 -type DWORD -verbose};
(gci -path "HKU:\*\Software\Microsoft\Office\*\OneNote\Options\").PsPath |
Foreach-Object {New-Item -Path "$_\embeddedfileopenoptions" -verbose};
(gci -path "HKU:\*\Software\Microsoft\Office\*\OneNote\Options\").PsPath |
Foreach-Object {New-ItemProperty -Path "$_\embeddedfileopenoptions" -Name "blockedextensions" -type string -value ".js;.exe;.bat;.vbs;.com;.scr;.cmd;.ps1" -verbose}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment