@ -4535,7 +4535,12 @@ public static bool MarkFileDelete (string sourcefile)
}
Remove-ItemProperty -Path HKCU : \ Environment -Name OneDrive , OneDriveConsumer -Force -ErrorAction Ignore
Remove-Item -Path HKCU : \ Software \ Microsoft \ OneDrive , HKLM : \ SOFTWARE \ WOW6432Node \ Microsoft \ OneDrive , " $ env:ProgramData\Microsoft OneDrive " , $env:SystemDrive \ OneDriveTemp -Recurse -Force -ErrorAction Ignore
$Path = @ (
" HKCU:\Software\Microsoft\OneDrive " ,
" $ env:ProgramData\Microsoft OneDrive " ,
" $ env:SystemDrive\OneDriveTemp "
)
Remove-Item -Path $Path -Recurse -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskName * OneDrive * -Confirm : $false -ErrorAction Ignore
# Getting the OneDrive folder path
@ -4587,7 +4592,7 @@ public static bool MarkFileDelete (string sourcefile)
return
}
if ( Test-Path -Path $env:SystemRoot \ System32 \ OneDriveSetup . exe )
if ( Test-Path -Path $env:SystemRoot \ SysWOW64 \ OneDriveSetup . exe )
{
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . OneDriveInstalling -Verbose
@ -8509,6 +8514,15 @@ function Set-Association
$ProgramPath = [System.Environment] :: ExpandEnvironmentVariables ( $ProgramPath )
if ( -not ( Test-Path -Path $ProgramPath ) )
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ( $Localization . RestartFunction -f $MyInvocation . Line ) -ErrorAction SilentlyContinue
return
}
if ( $Icon )
{
$Icon = [System.Environment] :: ExpandEnvironmentVariables ( $Icon )
@ -8804,23 +8818,27 @@ namespace RegistryUtils
$Extension
)
$OrigProgID = ( Get-ItemProperty -Path " HKLM:\SOFTWARE\Classes\ $ Extension " -Name " (default) " -ErrorAction Ignore ) . " (default) "
if ( $OrigProgID )
# Due to "Set-StrictMode -Version Latest" we have to check everything
if ( ( Test-Path -Path " HKLM:\SOFTWARE\Classes\ $ Extension " ) -and ( Get-ItemProperty -Path " HKLM:\SOFTWARE\Classes\ $ Extension " -Name " (default) " -ErrorAction Ignore ) )
{
if ( ( Get-ItemProperty -Path " HKLM:\SOFTWARE\Classes\ $ Extension " -Name " (default) " -ErrorAction Ignore ) . " (default) " )
{
# Save possible ProgIds history with extension
New-ItemProperty -Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts " -Name " $ ProgID_ $ Extension " -PropertyType DWord -Value 0 -Force
New-ItemProperty -Path HKCU : \ Software \ Microsoft \ Windows \ CurrentVersion \ ApplicationAssociationToasts -Name " $( $ProgID ) _ $( $Extension ) " -PropertyType DWord -Value 0 -Force
}
}
$Name = " {0}_ $ Extension " -f ( Split-Path -Path $ProgId -Leaf )
New-ItemProperty -Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts " -Name $Name -PropertyType DWord -Value 0 -Force
$Name = " {0}_ $( $Extension ) " -f ( Split-Path -Path $ProgId -Leaf )
New-ItemProperty -Path HKCU : \ Software \ Microsoft \ Windows \ CurrentVersion \ ApplicationAssociationToasts -Name $Name -PropertyType DWord -Value 0 -Force
if ( " $ ProgId_ $ Extension " -ne $Name )
if ( " $( $ProgID ) _ $( $Extension ) " -ne $Name )
{
New-ItemProperty -Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts " -Name " $ ProgId_ $ Extension " -PropertyType DWord -Value 0 -Force
New-ItemProperty -Path HKCU : \ Software \ Microsoft \ Windows \ CurrentVersion \ ApplicationAssociationToasts -Name " $( $ProgID ) _ $( $Extension ) " -PropertyType DWord -Value 0 -Force
}
# If ProgId doesn't exist set the specified ProgId for the extensions
if ( -not $OrigProgID )
# Due to "Set-StrictMode -Version Latest" we have to check everything
if ( -not ( Get-Variable -Name OrigProgID -ErrorAction Ignore ) )
{
if ( -not ( Test-Path -Path " HKCU:\Software\Classes\ $ Extension " ) )
{
@ -8837,7 +8855,8 @@ namespace RegistryUtils
New-ItemProperty -Path " HKCU:\Software\Classes\ $ Extension\OpenWithProgids " -Name $ProgId -PropertyType None -Value ( [byte[]] @ ( ) ) -Force
# Set the system ProgId to the extension parameters for the File Explorer to the possible options for the assignment, and if absent set the specified ProgId
if ( $OrigProgID )
# Due to "Set-StrictMode -Version Latest" we have to check everything
if ( Get-Variable -Name OrigProgID -ErrorAction Ignore )
{
if ( -not ( Test-Path -Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\ $ Extension\OpenWithProgids " ) )
{
@ -8895,13 +8914,17 @@ namespace RegistryUtils
)
# If there is the system extension ProgId, write it to the already configured by default
# Due to "Set-StrictMode -Version Latest" we have to check everything
if ( ( Test-Path -Path " HKLM:\SOFTWARE\Classes\ $ Extension " ) -and ( Get-ItemProperty -Path " HKLM:\SOFTWARE\Classes\ $ Extension " -Name " (default) " -ErrorAction Ignore ) )
{
if ( ( Get-ItemProperty -Path " HKLM:\SOFTWARE\Classes\ $ Extension " -Name " (default) " -ErrorAction Ignore ) . " (default) " )
{
if ( -not ( Test-Path -Path Registry :: HKEY_USERS \ . DEFAULT \ Software \ Microsoft \ Windows \ CurrentVersion \ FileAssociations \ ProgIds ) )
{
New-Item -Path Registry :: HKEY_USERS \ . DEFAULT \ Software \ Microsoft \ Windows \ CurrentVersion \ FileAssociations \ ProgIds -Force
}
New-ItemProperty -Path Registry :: HKEY_USERS \ . DEFAULT \ Software \ Microsoft \ Windows \ CurrentVersion \ FileAssociations \ ProgIds -Name " _ $ Extension " -PropertyType DWord -Value 1 -Force
New-ItemProperty -Path Registry :: HKEY_USERS \ . DEFAULT \ Software \ Microsoft \ Windows \ CurrentVersion \ FileAssociations \ ProgIds -Name " _ $( $Extension ) " -PropertyType DWord -Value 1 -Force
}
}
# Setting 'NoOpenWith' for all registered the extension ProgIDs
@ -8929,12 +8952,24 @@ namespace RegistryUtils
}
}
$picture = ( Get-ItemProperty -Path " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\KindMap " -Name $Extension -ErrorAction Ignore ) . $Extension
$PBrush = ( Get-ItemProperty -Path " HKLM:\SOFTWARE\Classes\PBrush\CLSID " -Name " (default) " -ErrorAction Ignore ) . " (default) "
# Due to "Set-StrictMode -Version Latest" we have to check everything
if ( Get-ItemProperty -Path HKLM : \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ KindMap -Name $Extension -ErrorAction Ignore )
{
$picture = ( Get-ItemProperty -Path HKLM : \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ KindMap -Name $Extension -ErrorAction Ignore ) . $Extension
}
# Due to "Set-StrictMode -Version Latest" we have to check everything
if ( ( Test-Path -Path HKLM : \ SOFTWARE \ Classes \ PBrush \ CLSID ) -and ( Get-ItemProperty -Path HKLM : \ SOFTWARE \ Classes \ PBrush \ CLSID -Name " (default) " -ErrorAction Ignore ) )
{
$PBrush = ( Get-ItemProperty -Path HKLM : \ SOFTWARE \ Classes \ PBrush \ CLSID -Name " (default) " -ErrorAction Ignore ) . " (default) "
}
# Due to "Set-StrictMode -Version Latest" we have to check everything
if ( Get-Variable -Name picture -ErrorAction Ignore )
{
if ( ( $picture -eq " picture " ) -and $PBrush )
{
New-ItemProperty -Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts " -Name " PBrush_ $ Extension " -PropertyType DWord -Value 0 -Force
New-ItemProperty -Path HKCU : \ Software \ Microsoft \ Windows \ CurrentVersion \ ApplicationAssociationToasts -Name " PBrush_ $( $Extension ) " -PropertyType DWord -Value 0 -Force
}
}
}