mirror of
https://github.com/zoicware/RemoveWindowsAI.git
synced 2026-01-11 10:14:44 +01:00
minor fixes
This commit is contained in:
@@ -832,47 +832,54 @@ Windows Registry Editor Version 5.00
|
|||||||
|
|
||||||
function Install-NOAIPackage {
|
function Install-NOAIPackage {
|
||||||
if (!$revert) {
|
if (!$revert) {
|
||||||
#check cpu arch
|
$package = Get-WindowsPackage -Online | Where-Object { $_.PackageName -like '*zoicware*' }
|
||||||
$arm = ((Get-CimInstance -Class Win32_ComputerSystem).SystemType -match 'ARM64') -or ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64')
|
if (!$package) {
|
||||||
$arch = if ($arm) { 'arm64' } else { 'amd64' }
|
#check cpu arch
|
||||||
#add cert to registry
|
$arm = ((Get-CimInstance -Class Win32_ComputerSystem).SystemType -match 'ARM64') -or ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64')
|
||||||
$certRegPath = 'HKLM:\Software\Microsoft\SystemCertificates\ROOT\Certificates\8A334AA8052DD244A647306A76B8178FA215F344'
|
$arch = if ($arm) { 'arm64' } else { 'amd64' }
|
||||||
if (!(Test-Path "$certRegPath")) {
|
#add cert to registry
|
||||||
New-Item -Path $certRegPath -Force | Out-Null
|
$certRegPath = 'HKLM:\Software\Microsoft\SystemCertificates\ROOT\Certificates\8A334AA8052DD244A647306A76B8178FA215F344'
|
||||||
}
|
if (!(Test-Path "$certRegPath")) {
|
||||||
|
New-Item -Path $certRegPath -Force | Out-Null
|
||||||
#check if script is being ran locally
|
|
||||||
if ((Test-Path "$PSScriptRoot\RemoveWindowsAIPackage\amd64") -and (Test-Path "$PSScriptRoot\RemoveWindowsAIPackage\arm64")) {
|
|
||||||
Write-Status -msg 'RemoveWindowsAI Packages Found Locally...'
|
|
||||||
|
|
||||||
Write-Status -msg 'Installing RemoveWindowsAI Package...'
|
|
||||||
try {
|
|
||||||
Add-WindowsPackage -Online -PackagePath "$PSScriptRoot\RemoveWindowsAIPackage\$arch\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -NoRestart -IgnoreCheck -ErrorAction Stop
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
#user is using powershell 7 use dism command as fallback
|
|
||||||
dism.exe /Online /Add-Package /PackagePath:"$PSScriptRoot\RemoveWindowsAIPackage\$arch\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" /NoRestart /IgnoreCheck
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#check if script is being ran locally
|
||||||
|
if ((Test-Path "$PSScriptRoot\RemoveWindowsAIPackage\amd64") -and (Test-Path "$PSScriptRoot\RemoveWindowsAIPackage\arm64")) {
|
||||||
|
Write-Status -msg 'RemoveWindowsAI Packages Found Locally...'
|
||||||
|
|
||||||
|
Write-Status -msg 'Installing RemoveWindowsAI Package...'
|
||||||
|
try {
|
||||||
|
Add-WindowsPackage -Online -PackagePath "$PSScriptRoot\RemoveWindowsAIPackage\$arch\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -NoRestart -IgnoreCheck -ErrorAction Stop >$null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
#user is using powershell 7 use dism command as fallback
|
||||||
|
dism.exe /Online /Add-Package /PackagePath:"$PSScriptRoot\RemoveWindowsAIPackage\$arch\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" /NoRestart /IgnoreCheck >$null
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Status -msg 'Downloading RemoveWindowsAI Package From Github...'
|
||||||
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
|
try {
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/zoicware/RemoveWindowsAI/raw/refs/heads/main/RemoveWindowsAIPackage/$arch/ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -OutFile "$env:TEMP\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -UseBasicParsing -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Status -msg "Unable to Download Package at: https://github.com/zoicware/RemoveWindowsAI/raw/refs/heads/main/RemoveWindowsAIPackage/$arch/ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -errorOutput
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Status -msg 'Installing RemoveWindowsAI Package...'
|
||||||
|
try {
|
||||||
|
Add-WindowsPackage -Online -PackagePath "$env:TEMP\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -NoRestart -IgnoreCheck -ErrorAction Stop >$null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
dism.exe /Online /Add-Package /PackagePath:"$env:TEMP\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" /NoRestart /IgnoreCheck >$null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Status -msg 'Downloading RemoveWindowsAI Package From Github...'
|
Write-Status -msg 'Update package already installed... Skipping'
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
#Write-Host $($package | Select-Object *)
|
||||||
try {
|
|
||||||
Invoke-WebRequest -Uri "https://github.com/zoicware/RemoveWindowsAI/raw/refs/heads/main/RemoveWindowsAIPackage/$arch/ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -OutFile "$env:TEMP\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -UseBasicParsing -ErrorAction Stop
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Status -msg "Unable to Download Package at: https://github.com/zoicware/RemoveWindowsAI/raw/refs/heads/main/RemoveWindowsAIPackage/$arch/ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -errorOutput
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Status -msg 'Installing RemoveWindowsAI Package...'
|
|
||||||
try {
|
|
||||||
Add-WindowsPackage -Online -PackagePath "$env:TEMP\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" -NoRestart -IgnoreCheck -ErrorAction Stop
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
dism.exe /Online /Add-Package /PackagePath:"$env:TEMP\ZoicwareRemoveWindowsAI-$($arch)1.0.0.0.cab" /NoRestart /IgnoreCheck
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1508,7 +1515,7 @@ function Remove-AI-CBS-Packages {
|
|||||||
if ($value -ne $null) {
|
if ($value -ne $null) {
|
||||||
if ($value -eq 2 -and $_.PSChildName -like '*AIX*' -or $_.PSChildName -like '*Recall*' -or $_.PSChildName -like '*Copilot*' -or $_.PSChildName -like '*CoreAI*') {
|
if ($value -eq 2 -and $_.PSChildName -like '*AIX*' -or $_.PSChildName -like '*Recall*' -or $_.PSChildName -like '*Copilot*' -or $_.PSChildName -like '*CoreAI*') {
|
||||||
Set-ItemProperty "registry::$($_.Name)" -Name Visibility -Value 1 -Force
|
Set-ItemProperty "registry::$($_.Name)" -Name Visibility -Value 1 -Force
|
||||||
New-ItemProperty "registry::$($_.Name)" -Name DefVis -PropertyType DWord -Value 2 -Force
|
New-ItemProperty "registry::$($_.Name)" -Name DefVis -PropertyType DWord -Value 2 -Force | Out-Null
|
||||||
Remove-Item "registry::$($_.Name)\Owners" -Force -ErrorAction SilentlyContinue
|
Remove-Item "registry::$($_.Name)\Owners" -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item "registry::$($_.Name)\Updates" -Force -ErrorAction SilentlyContinue
|
Remove-Item "registry::$($_.Name)\Updates" -Force -ErrorAction SilentlyContinue
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user