Here are 2 quick lines of code that help you uninstall a Program:
$Prog = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -match “ProgramName”}
$Prog.Uninstall()
Reading time: 1 min
Here are 2 quick lines of code that help you uninstall a Program:
$Prog = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -match “ProgramName”}
$Prog.Uninstall()
If you need to deploy a MS Store App for example through Intune or GPO, here is my script:
First of all you need the App ID of the store app. Go to https://apps.microsoft.com/ search for the app and select it. In the URL you will see something like this: https://apps.microsoft.com/detail/9nw77489ngj0?hl=en-us&gl=US. 9nw77489ngj0 is the App ID.
Now the script:
Start-Transcript -Path “C:\3cx_msstore.log”
$appid=”9NW77489NGJ0″
winget install -e –id $appid –source msstore –accept-source-agreements –accept-package-agreements
winget upgrade –id $appid
Stop-Transcript
If you need to perform a packet capture under Windows without having to install Wireshark, here are some netsh commands:
netsh trace start capture=yes tracefile=c:\net.etl persistent=yes maxsize=4096 filemode=circular overwrite=yes report=no
When you are done with your capture do:
netsh trace stop
This will take some time.
You will see the files under C:\net.etl and net.cab
As a follow up to my last article regarding Microsoft Teams NEW Addin missing in Outlook https://www.ajni.it/2024/03/microsoft-teams-lightweight-teams-meeting-addin-in-outlook-missing/, this script might help you if there are still some issues especially on Terminal Services/RDS 2019/2022.
This script registers Microsoft.Teams.Addin.Loader.dll as the current user, so it has to run at logon.
if (-not ($NewTeamsPackageVersion = (Get-AppxPackage -Name MSTeams).Version)) {
Write-Host "New Teams Package not found. Please install new Teams from https://aka.ms/GetTeams ."
exit 1
}
Write-Host "Found new Teams Version: $NewTeamsPackageVersion"
$TMAPath = "{0}\WINDOWSAPPS\MSTEAMS_{1}_X64__8WEKYB3D8BBWE\MICROSOFTTEAMSMEETINGADDININSTALLER.MSI" -f $env:programfiles,$NewTeamsPackageVersion
if (-not ($TMAVersion = (Get-AppLockerFileInformation -Path $TMAPath | Select-Object -ExpandProperty Publisher).BinaryVersion))
{
Write-Host "Teams Meeting Addin not found in $TMAPath."
exit 1
}
Write-Host "Found Teams Meeting Addin Version: $TMAVersion"
$TMAParam= '/s /n /i:user "C:\Program Files (x86)\Microsoft\TeamsMeetingAddin{0}\x86\Microsoft.Teams.AddinLoader.dll"' -f $TMAVersion
Start-Process "C:\windows\System32\regsvr32.exe" -ArgumentList $TMAParam
A follow-up on the last post here is another way to run msiexec through PowerShell.
For example, here is how you can install OCS inventory agent with some parameters. OCS is an open source inventarization system.
Start-Process -FilePath .\OCS-Windows-Agent-Setup-x64.exe -ArgumentList ‘/S /NOSPLASH /NOW /SERVER=https://inventory.ajni.it//ocsinventory /TAG=”a” /SSL=0’
References:
https://www.ajni.it/2024/04/run-msiexec-transforms-with-powershell/
Like what you are reading? Buy me a coffee.