I have got the scripts to uninstall Teams Machine Wide Installer and then I have script to install Teams client. I want to do the following steps
Copy Teams to a folder
Run the Uninstall Teams Machine Wide Installer Script
Run the Teams install scripts
How can we do it?
Start with the favorite response, it depends. How do you intend to run this on the system? PowerShell remotely? SCCM? There are other things that you would likely need to do, such as kill all Teams processes.
1. Copy Teams to a folder
There are many examples of working with Files\Folders, likely would be Get-Item, Copy-Item or Move-Item. Working with files and folders - PowerShell | Microsoft Learn
As mentioned, you cannot move files in use, so you would need to look at:
Get-Process and Stop-Process Managing processes with Process cmdlets - PowerShell | Microsoft Learn
2. Run the Uninstall Teams Machine Wide Installer Script
There is a script built to perform the uninstall? Is it a Powershell script?
3. Run the Teams install scripts
There is a script built to perform the install? Is it a Powershell script? Or Scripts (plural)?
Use PSDT for such thinks.