@ -1218,7 +1218,7 @@ function DiagnosticDataLevel
{
" Minimal "
{
if ( Get-WindowsEdition -Online | Where-Object -FilterScript { ( $_ . Edition -lik e " Enterprise* " ) -or ( $_ . Edition -eq " Education " ) } )
if ( Get-WindowsEdition -Online | Where-Object -FilterScript { ( $_ . Edition -eq " Enterprise " ) -or ( $_ . Edition -eq " Education " ) } )
{
# Diagnostic data off
New-ItemProperty -Path HKLM : \ SOFTWARE \ Policies \ Microsoft \ Windows \ DataCollection -Name AllowTelemetry -PropertyType DWord -Value 0 -Force
@ -4651,10 +4651,11 @@ function OneDrive
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Script:Signature = @ {
Namespace = " WinAPI "
Name = " DeleteFiles "
Language = " CSharp "
MemberDefinition = @ "
Namespace = " WinAPI "
Name = " DeleteFiles "
Language = " CSharp "
CompilerParameters = $CompilerParameters
MemberDefinition = @ "
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -7040,7 +7041,7 @@ function Set-UserShellFolderLocation
)
$KnownFolders = @ {
" Desktop " = @ ( " B4BFCC3A-DB2C-424C-B029-7FE99A87C641 " ) ;
" Desktop " = @ ( " B4BFCC3A-DB2C-424C-B029-7FE99A87C641 " )
" Documents " = @ ( " FDD39AD0-238F-46AF-ADB4-6C85480369C7 " , " f42ee2d3-909f-4907-8871-4c22fc0bf756 " )
" Downloads " = @ ( " 374DE290-123F-4565-9164-39C4925E467B " , " 7d83ee9b-2244-4e70-b1f5-5404642af1e4 " )
" Music " = @ ( " 4BD8D571-6D19-48D3-BE97-422220080E43 " , " a0c69a99-21c8-4671-8703-7934162fcf1d " )
@ -13005,6 +13006,60 @@ function PUAppsDetection
}
}
<#
. SYNOPSIS
Sandboxing for Microsoft Defender
. PARAMETER Enable
Enable sandboxing for Microsoft Defender
. PARAMETER Disable
Disable sandboxing for Microsoft Defender
. EXAMPLE
DefenderSandbox -Enable
. EXAMPLE
DefenderSandbox -Disable
. NOTES
Machine-wide
#>
function DefenderSandbox
{
param
(
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Enable "
) ]
[switch]
$Enable ,
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Disable "
) ]
[switch]
$Disable
)
if ( $Script:DefenderEnabled )
{
switch ( $PSCmdlet . ParameterSetName )
{
" Enable "
{
setx / M MP_FORCE_USE_SANDBOX 1
}
" Disable "
{
setx / M MP_FORCE_USE_SANDBOX 0
}
}
}
}
# Dismiss Microsoft Defender offer in the Windows Security about signing in Microsoft account
function DismissMSAccount
{
@ -13549,7 +13604,7 @@ function WindowsSandbox
$Enable
)
if ( -not ( Get-WindowsEdition -Online | Where-Object -FilterScript { ( $_ . Edition -eq " Professional " ) -or ( $_ . Edition -lik e " Enterprise* " ) } ) )
if ( -not ( Get-WindowsEdition -Online | Where-Object -FilterScript { ( $_ . Edition -eq " Professional " ) -or ( $_ . Edition -eq " Enterprise " ) -or ( $_ . Edition -eq " Education " ) } ) )
{
return
}
@ -13973,63 +14028,6 @@ function CABInstallContext
}
}
<#
. SYNOPSIS
The " Cast to Device " item in the media files and folders context menu
. PARAMETER Hide
Hide the " Cast to Device " item from the media files and folders context menu
. PARAMETER Show
Show the " Cast to Device " item in the media files and folders context menu
. EXAMPLE
CastToDeviceContext -Hide
. EXAMPLE
CastToDeviceContext -Show
. NOTES
Current user
#>
function CastToDeviceContext
{
param
(
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Hide "
) ]
[switch]
$Hide ,
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Show "
) ]
[switch]
$Show
)
Remove-ItemProperty -Path " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked " -Name " {7AD84985-87B4-4a16-BE58-8B72A5B390F7} " -Force -ErrorAction Ignore
switch ( $PSCmdlet . ParameterSetName )
{
" Hide "
{
if ( -not ( Test-Path -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked " ) )
{
New-Item -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked " -Force
}
New-ItemProperty -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked " -Name " {7AD84985-87B4-4a16-BE58-8B72A5B390F7} " -PropertyType String -Value " " -Force
}
" Show "
{
Remove-ItemProperty -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked " -Name " {7AD84985-87B4-4a16-BE58-8B72A5B390F7} " -Force -ErrorAction Ignore
}
}
}
<#
. SYNOPSIS
The " Edit with Clipchamp " item in the media files context menu
@ -14145,108 +14143,6 @@ function PrintCMDContext
}
}
<#
. SYNOPSIS
The " Include in Library " item in the folders and drives context menu
. PARAMETER Hide
Hide the " Include in Library " item from the folders and drives context menu
. PARAMETER Show
Show the " Include in Library " item in the folders and drives context menu
. EXAMPLE
IncludeInLibraryContext -Hide
. EXAMPLE
IncludeInLibraryContext -Show
. NOTES
Current user
#>
function IncludeInLibraryContext
{
param
(
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Hide "
) ]
[switch]
$Hide ,
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Show "
) ]
[switch]
$Show
)
switch ( $PSCmdlet . ParameterSetName )
{
" Hide "
{
New-ItemProperty -Path " Registry::HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\Library Location " -Name " (default) " -PropertyType String -Value " -{3dad6c5d-2167-4cae-9914-f99e41c12cfa} " -Force
}
" Show "
{
New-ItemProperty -Path " Registry::HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\Library Location " -Name " (default) " -PropertyType String -Value " {3dad6c5d-2167-4cae-9914-f99e41c12cfa} " -Force
}
}
}
<#
. SYNOPSIS
The " Send to " item in the folders context menu
. PARAMETER Hide
Hide the " Send to " item from the folders context menu
. PARAMETER Show
Show the " Send to " item in the folders context menu
. EXAMPLE
SendToContext -Hide
. EXAMPLE
SendToContext -Show
. NOTES
Current user
#>
function SendToContext
{
param
(
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Hide "
) ]
[switch]
$Hide ,
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Show "
) ]
[switch]
$Show
)
switch ( $PSCmdlet . ParameterSetName )
{
" Hide "
{
New-ItemProperty -Path Registry :: HKEY_CLASSES_ROOT \ AllFilesystemObjects \ shellex \ ContextMenuHandlers \ SendTo -Name " (default) " -PropertyType String -Value " -{7BA4C740-9E81-11CF-99D3-00AA004AE837} " -Force
}
" Show "
{
New-ItemProperty -Path Registry :: HKEY_CLASSES_ROOT \ AllFilesystemObjects \ shellex \ ContextMenuHandlers \ SendTo -Name " (default) " -PropertyType String -Value " {7BA4C740-9E81-11CF-99D3-00AA004AE837} " -Force
}
}
}
<#
. SYNOPSIS
The " Compressed (zipped) Folder " item in the " New " context menu
@ -14572,61 +14468,6 @@ function OpenWindowsTerminalAdminContext
# Save in UTF-8 with BOM despite JSON must not has the BOM: https://datatracker.ietf.org/doc/html/rfc8259#section-8.1. Unless Terminal profile names which contains non-Latin characters will have "?" instead of titles
ConvertTo-Json -InputObject $Terminal -Depth 4 | Set-Content -Path " $ env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json " -Encoding UTF8 -Force
}
<#
. SYNOPSIS
The " Show more options " in the context menu
. PARAMETER Enable
Enable the Windows 10 context menu style
. PARAMETER Disable
Disable the Windows 10 context menu style
. EXAMPLE
Windows10ContextMenu -Enable
. EXAMPLE
Windows10ContextMenu -Disable
. NOTES
Current user
#>
function Windows10ContextMenu
{
param
(
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Disable "
) ]
[switch]
$Disable ,
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Enable "
) ]
[switch]
$Enable
)
switch ( $PSCmdlet . ParameterSetName )
{
" Disable "
{
Remove-Item -Path " HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2} " -Recurse -Force -ErrorAction Ignore
}
" Enable "
{
if ( -not ( Test-Path -Path " HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 " ) )
{
New-Item -Path " HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 " -ItemType Directory -Force
}
New-ItemProperty -Path " HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 " -Name " (default) " -PropertyType String -Value " " -Force
}
}
}
#endregion Context menu
#region Update Policies