Removed checking of appId using result parsing, since appId is already a parameter, added command to remove unprovisioned Notepad++ package, which breaks Sysprep

This commit is contained in:
Zehadi Alam
2024-07-12 23:40:59 -04:00
parent 191c30dd65
commit ab58b27a1d
3 changed files with 12 additions and 6 deletions
+5
View File
@@ -9,6 +9,11 @@
"name": "Company Portal", "name": "Company Portal",
"id": "9WZDNCRFJ3PZ", "id": "9WZDNCRFJ3PZ",
"source": "msstore" "source": "msstore"
},
{
"name": "Microsoft Teams",
"id": "Microsoft.Teams",
"source": "winget"
} }
] ]
} }
@@ -51,6 +51,11 @@ for /d %%D in ("%basepath%\*") do (
) )
:remaining :remaining
endlocal endlocal
for /r "D:\" %%G in (.) do (
if exist "%%G\Notepad++" (
powershell -Command "Remove-AppxPackage -Package NotepadPlusPlus_1.0.0.0_neutral__7njy0v32s6xk6"
)
)
REM The below lines will remove the unattend.xml that gets the machine into audit mode. If not removed, the OS will get stuck booting to audit mode each time. REM The below lines will remove the unattend.xml that gets the machine into audit mode. If not removed, the OS will get stuck booting to audit mode each time.
REM Also kills the sysprep process in order to automate sysprep generalize REM Also kills the sysprep process in order to automate sysprep generalize
del c:\windows\panther\unattend\unattend.xml /F /Q del c:\windows\panther\unattend\unattend.xml /F /Q
+2 -6
View File
@@ -1811,18 +1811,14 @@ function Get-StoreApp {
WriteLog "$StoreAppName not found in WinGet repository. Skipping download." WriteLog "$StoreAppName not found in WinGet repository. Skipping download."
return return
} }
# Skip the header lines and get the line with the app information
$appResult = $wingetSearchResult | Select-Object -Skip 2 | Select-Object -First 1
# Split the line by whitespace and get the second-to-last item (the Id)
$appID = ($appResult -split '\s+')[-2]
# Checking app ID to determine if store app is a win32 app
WriteLog "Checking if $StoreAppName is a win32 app..." WriteLog "Checking if $StoreAppName is a win32 app..."
$appIsWin32 = $appID.StartsWith("XP") $appIsWin32 = $StoreAppId.StartsWith("XP")
if ($appIsWin32) { if ($appIsWin32) {
WriteLog "$StoreAppName is a win32 app. Adding to $AppsPath\win32 folder" WriteLog "$StoreAppName is a win32 app. Adding to $AppsPath\win32 folder"
$appFolderPath = Join-Path -Path "$AppsPath\win32" -ChildPath $StoreAppName $appFolderPath = Join-Path -Path "$AppsPath\win32" -ChildPath $StoreAppName
} }
else { else {
WriteLog "$StoreAppName is not a win32 app."
$appFolderPath = Join-Path -Path "$AppsPath\MSStore" -ChildPath $StoreAppName $appFolderPath = Join-Path -Path "$AppsPath\MSStore" -ChildPath $StoreAppName
} }
New-Item -Path $appFolderPath -ItemType Directory -Force | Out-Null New-Item -Path $appFolderPath -ItemType Directory -Force | Out-Null