I have a script that I can’t get the output to write to a file. This is the script:
[pre]$AppsList = 'Microsoft.3DBuilder', 'Microsoft.BingFinance', 'Microsoft.BingNews', 'Microsoft.BingSports', 'Microsoft.MicrosoftSolitaireCollection', 'Microsoft.People', 'Microsoft.Windows.Photos', 'Microsoft.WindowsCamera', 'microsoft.windowscommunicationsapps', 'Microsoft.WindowsPhone', 'Microsoft.WindowsSoundRecorder', 'Microsoft.XboxApp', 'Microsoft.ZuneMusic', 'Microsoft.ZuneVideo', 'Microsoft.Getstarted', 'Microsoft.WindowsFeedbackHub', 'Microsoft.XboxIdentityProvider', 'Microsoft.MicrosoftOfficeHub', 'Fitbit.FitbitCoach', 'ThumbmunkeysLtd.PhototasticCollage', 'Microsoft.People', 'king.com.CandyCrushFriends'#Start-Transcript -Path ‘E:\Dnload\Sysprep\RemoveAllAppxPackages.txt’ -append
ForEach ($App in $AppsList){
$PackageFullName = (Get-AppxPackage -AllUsers “$App”).PackageFullName
$ProPackageFullName = (Get-AppxProvisionedPackage -online | where {$_.Displayname -eq $App}).PackageName
$PackageFullName | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
$ProPackageFullName | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
if ($PackageFullName){
“Removing Package: $App” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
remove-AppxPackage -package $PackageFullName -AllUsers | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
}else{
“Unable to find package: $App” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
}if ($ProPackageFullName){
“Removing Provisioned Package: $ProPackageFullName” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
Remove-AppxProvisionedPackage -online -packagename $ProPackageFullName | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
pause
}else{
“Unable to find provisioned package: $App” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
pause
}
}
Pause
#Stop-Transcript[/pre]