Hi All,
Please suggest how to run below power shell command through BigFix .
Define the log file path
$logFilePath = “C:\Windows\Temp\MSTeamsPersonalRemoved.log”
$logFilePathNotFound = “C:\Windows\Temp\MSTeamsPersonalNotFound.log”
Remove-Item -Path $logFilePath -Force
Remove-Item -Path $logFilePathNotFound -Force
Get the package family name for Microsoft Teams with “bbwe”
$teamsPackage = Get-AppxPackage | Where-Object { $_.PackageFamilyName -like “MicrosoftTeams_8wekyb3d8bbwe” }
Check if the package is found
if ($teamsPackage) {
# Uninstall the package using the PackageFullName
$packageFullName = $teamsPackage.PackageFullName
$packageFullName
Remove-AppxPackage -Package $packageFullName
Write-Host “Microsoft Teams personal app has been uninstalled successfully.”
New-Item -Path $logFilePath -ItemType File
} else {
Write-Host “Microsoft Teams personal app is not found on this system.”
New-Item -Path $logFilePathNotFound -ItemType File
}
You can use native PowerShell option while creating Fixlet/task, see below:
But make sure to test & run silently before using it BigFix.
2 Likes
This isn’t meant to be rude…
but if you search the forum, there are I believe at least 10 good threads… and a few of those cover multiple ways to run scripts, and caveats like 32 vs 64bit execution, etc. You’ll probably learn a few more tricks then starting another thread on the same topic.
1 Like
I have tried to run below command but getting failed with (exit code=1 its seems like incorrect function). Could you please correct me where i getting error?
// Disable wow64 redirection on x64 OSes
action uses wow64 redirection {not x64 of operating system}
delete __createfile
// CREATEFILE
createfile until END_OF_FILE
Define the log file path
$logFilePath = “C:\Windows\Temp\MSTeamsPersonalRemoved.log”
$logFilePathNotFound = “C:\Windows\Temp\MSTeamsPersonalNotFound.log”
Remove-Item -Path $logFilePath -Force
Remove-Item -Path $logFilePathNotFound -Force
Get the package family name for Microsoft Teams with “bbwe”
$teamsPackage = Get-AppxPackage | Where-Object { $_.PackageFamilyName -like “MicrosoftTeams_8wekyb3d8bbwe” }
Check if the package is found
if ($teamsPackage) {
# Uninstall the package using the PackageFullName
$packageFullName = $teamsPackage.PackageFullName
$packageFullName
Remove-AppxPackage -Package $packageFullName
Write-Host “Microsoft Teams personal app has been uninstalled successfully.”
New-Item -Path $logFilePath -ItemType File
} else {
Write-Host “Microsoft Teams personal app is not found on this system.”
New-Item -Path $logFilePathNotFound -ItemType File
}
get-help | Out-File “{(pathname of folder “__BESData__Global\Logs” of parent folder of client)}\config_powershell.log”
END_OF_FILE
delete powershell.ps1
move __createfile powershell.ps1
waithidden {pathname of file ((it as string) of value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) } -ExecutionPolicy Bypass -File powershell.ps1
Are you utilizing it with native PowerShell execution? If so, it will not function since native PowerShell cannot perform the BigFix action script; additionally, if you want, you must escape curly brackets within your ps script.
Escaping curly brackets in Action Script (hcltechsw.com)
Did you attempt running your original ps script using the native PowerShell option?