This post will make life easier for those packaging Teams for deployment.
If you endeavour to read the Microsoft documentation about Teams deployment, you will notice that it is not a simple task. There are different types of downloads, the 64-bit version installs under the Program Files (x86), Teams has its own process to receive updates, and if you uninstall Teams, you will need to clean a bunch of folders and registry keys to install it again.
Microsoft also recommends installing the 64-bit version of Teams, even if you use the 32-bit version of Microsoft 365 Apps for enterprise, also known as Microsoft Office or Microsoft 365 Apps.
So, let’s start.
Download Files
- SetupTeams.zip – This ZIP file contains two files: SetupTeams.ps1 and CleanTeamsRegistry.vbs. Each one explained below.
- Microsoft Teams – Most of us will use the Commercial 64-bit version.
The Scripts Explained
I will use PowerShell in this post, but please, let me know if you would like to perform the same deployment using Batch Script. I prefer to work with Batch Scripts because of their reliability.
The SetupTeams.ps1 file
.SYNOPSIS
Full Teams re-installer.
.DESCRIPTION
Fully uninstall Teams from all local profiles, cleaning up registry and folders, installing it again.
.NOTES
Author: Lucas Silickas
Version 1.0.0
- Initial Creation
#>
# Kill Teams running processes
$ProcessList = @(
"Teams"
)
Do {
$ProcessesFound = Get-Process | Where-Object { $ProcessList -contains $_.Name } | Select-Object -ExpandProperty Name
If ($ProcessesFound) {
Write-Host "Still running: $($ProcessesFound)"
Start-Sleep 3
Stop-Process -Name "$ProcessList" -Force -ErrorAction SilentlyContinue
}
} Until (!$ProcessesFound)
# Uninstall Teams for each local profile
if (test-path $env:ALLUSERSPROFILE*MicrosoftTeamsCurrentTeams.exe) {
(Get-ItemProperty $env:ALLUSERSPROFILE*MicrosoftTeamsCurrent).PSParentPath | foreach-object { Start-Process -ErrorAction SilentlyContinue $_Update.exe -ArgumentList "--uninstall /s" -PassThru -Wait }
}
if (test-path $env:SystemDriveUsers*AppDataLocalMicrosoftTeamsCurrentTeams.exe) {
(Get-ItemProperty $env:SystemDriveUsers*AppDataLocalMicrosoftTeamsCurrent).PSParentPath | foreach-object { Start-Process -ErrorAction SilentlyContinue $_Update.exe -ArgumentList "--uninstall /s" -PassThru -Wait }
}
# Uninstall Teams Machine-Wide
$AppName = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*teams*" }
if ($null -ne $AppName) { $AppName.Uninstall() }
# Cleanup Folders
if (test-path $env:SystemDriveUsers*AppDataLocalMicrosoftTeams) {
(Get-ItemProperty $env:SystemDriveUsers*AppDataLocalMicrosoftTeams) | ForEach-Object { Remove-Item $_ -force -Recurse -ErrorAction SilentlyContinue }
}
if (test-path $env:ALLUSERSPROFILE*MicrosoftTeams) {
(Get-ItemProperty $env:ALLUSERSPROFILE*MicrosoftTeams) | ForEach-Object { Remove-Item $_ -force -Recurse -ErrorAction SilentlyContinue }
}
# Remove Teams registry keys from all local profiles
Start-Process -FilePath "cscript.exe" -ArgumentList "./CleanTeamsRegistry.vbs" -NoNewWindow -Wait
# Install Teams Wide-Machine
$params = '/i', 'Teams_windows_x64.msi',
'ALLUSERS=1', '/qn'
$p = Start-Process 'msiexec.exe' -ArgumentList $params -NoNewWindow -Wait -PassThru
$p.ExitCode
# CM detection setting
if ($p.ExitCode -eq 0) {
REG ADD "HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstallRemendar" /f
REG ADD "HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstallRemendar" /v "Microsoft Teams" /t REG_SZ /d "Rem_1.0" /f
}
else { $p.ExitCode }
The CleanTeamsRegistry.vbs file
On Error Resume Next
'
'
'
' Script name: CleanTeamsRegistry.vbs
' Run with cscript to suppress dialogs: cscript.exe CleanTeamsRegistry.vbs
'
'
'
'
'
Dim WshShell, RegRoot, objFSO
Set WshShell = CreateObject("WScript.shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
'
Const DAT_NTUSER = &H70000000
Const DAT_USRCLASS = &H70000001
'==================================================================================================================================================
' SCRIPT BEGINS HERE
'==================================================================================================================================================
'
'This is where our HKCU is temporarily loaded, and where we need to write to it
RegRoot = "HKLMTEMPHIVE" ' You don't really need to change this, but you can if you want
'== Loads each user's "HKCU" registry hive
Call Load_Registry_For_Each_User(DAT_NTUSER)
'== Loads each user's "HKCR" registry hive
Call Load_Registry_For_Each_User(DAT_USRCLASS)
WScript.Echo vbCrLf & "Processing complete!"
WScript.Quit(0)
' |
' |
'====================================================================
Sub KeysToModify(sRegistryRootToUse, DAT_FILE)
'============================================================================================================================================
' Change variables here, or add additional keys
'============================================================================================================================================
'
On Error Resume Next
If DAT_FILE = DAT_NTUSER Then 'This is for updating HKCU keys
Dim strRegPathParent01
Dim strRegPathParent02
Dim strRegPathParent03
'strRegPathParent01 = "SoftwareacQuireacQuire3400Security"
'WshShell.RegWrite sRegistryRootToUse & "" & strRegPathParent01 & "Behaviour", "00000002", "REG_DWORD"
'WshShell.RegWrite sRegistryRootToUse & "" & strRegPathParent01 & "ServerName", "GFAU-LIC-SGM-ACQUIRE", "REG_SZ"
'===
'REG_BINARY values are special
'===
'
' 1st step is to create subkey path
'WshShell.RegWrite sRegistryRootToUse & "" & strRegPathParent03 & "", ""
'SetBinaryRegKeys sRegistryRootToUse, strRegPathParent03, "My Test Binary Value","hex:23,00,41,00,43,00,42,00,6c,00"
'
' You can add additional registry keys to write here if you would like
'
'==================================================================================================================================
' DELETING KEYS
'==================================================================================================================================
'
' This will RECURSIVELY delete the parent reg key and all items below it.
' USE CAUTION!
'
Dim sSubkeyPathToDelete
sSubkeyPathToDelete = "SOFTWAREMicrosoftOfficeTeams"
'
Call DeleteSubkeysRecursively(sRegistryRootToUse, sSubkeyPathToDelete) ' recursively deletes the binary reg key we added earlier
'
'
' This will delete just a single value
Call DeleteSingleValue(sRegistryRootToUse, strRegPathParent02, "FormSuggest PW Ask") ' deletes the 'FormSuggest PW Ask' key set earlier
'
ElseIf DAT_FILE = DAT_USRCLASS Then ' This is for updating HKCR keys per-user
Dim sHkcrParent01
'sHkcrParent01 = "SoftwareMicrosoftMediaPlayerPreferences"
'sHkcrParent01 = "FirefoxURL"
'WshShell.RegWrite sRegistryRootToUse & "" & sHkcrParent01 & "FriendlyTypeName", "Firefox URL", "REG_SZ"
End If
End Sub
'
'
'
'
'
'
'
' NO CHANGES NECESSARY BELOW THIS LINE
'
'
'
'
'
'
'
'
'
Sub DeleteSingleValue(RegRoot, strRegistryKey, strValue)
On Error Resume Next
If Left(strRegistryKey,1) = "" Then
strRegistryKey = Mid(strRegistryKey, 2)
End If
WshShell.Run "reg.exe delete " & chr(34) & RegRoot & "" & strRegistryKey & chr(34) & " /v " & chr(34) & strValue & chr(34) & " /f", 0, True
End Sub
Sub DeleteSubkeysRecursively(RegRoot, strRegistryKey)
On Error Resume Next
'
' BE VERY CAREFUL CALLING THIS SUB
'
' This will RECURSIVELY delete the requested path...meaning
' it will delete the path and everything beneath it!
'
' This action cannot be undone!
'
If Left(strRegistryKey,1) = "" Then
strRegistryKey = Mid(strRegistryKey, 2)
End If
WshShell.Run "reg.exe delete " & chr(34) & RegRoot & "" & strRegistryKey & chr(34) & " /f", 0, True
'wscript.echo "reg.exe delete " & chr(34) & RegRoot & "" & strRegistryKey & chr(34) & " /f"
End Sub
Function SetBinaryRegKeys(sRegistryRootToUse, strRegPathParent, sKeyName, sHexString)
On Error Resume Next
Dim sBinRegRoot
Dim sBinRegPartialPath
Dim arrBinRegRoot
arrBinRegRoot = GetRegRootToUseForBinaryValues(sRegistryRootToUse)
sBinRegRoot = arrBinRegRoot(0)
sBinRegPartialPath = arrBinRegRoot(1)
If Len(sBinRegPartialPath) > 0 Then
sBinRegPartialPath = sBinRegPartialPath & ""
End If
WriteBinaryValue sBinRegRoot, sBinRegPartialPath & strRegPathParent, sKeyName, sHexString
End Function
Function WriteBinaryValue(RegHive, strKeyPath, strValueName, strHexValues)
On Error Resume Next
Dim objRegistry
Dim arrHexValues, arrDecValues
Set objRegistry = GetObject("Winmgmts:rootdefault:StdRegProv")
'Example: strHexData = "hex:23,00,41,00,43,00,42,00,6c,00"
arrHexValues = Split(Replace(strHexValues, "hex:", ""), ",")
arrDecValues = DecimalNumbers(arrHexValues)
Dim iResult
iResult = objRegistry.SetBinaryValue (RegHive, _
strKeyPath, strValueName, arrDecValues)
If (iResult = 0) Then
'Wscript.Echo "Binary value added successfully"
Else
Wscript.Echo "*** Error adding binary value at " & strKeyPath & "" & strValueName
End If
End Function
Function GetRegRootToUseForBinaryValues(sRegRoot)
On Error Resume Next
Dim sNewRoot
Dim sPartialPath
sRegRoot = UCase(sRegRoot)
'HKEY_CURRENT_USER
'
If Left(sRegRoot,Len("HKCU")) = "HKCU" Then
sNewRoot = HKEY_CURRENT_USER
sPartialPath = Replace(sRegRoot,"HKCU",1, Len("HKCU") + 1)
ElseIf Left(sRegRoot,Len("HKCU")) = "HKCU" Then
sNewRoot = HKEY_CURRENT_USER
sPartialPath = Replace(sRegRoot,"HKCU",1, Len("HKCU") + 1)
ElseIf Left(sRegRoot,Len("HKEY_CURRENT_USER")) = "HKEY_CURRENT_USER" Then
sNewRoot = HKEY_CURRENT_USER
sPartialPath = Replace(sRegRoot,"HKEY_CURRENT_USER",1, Len("HKEY_CURRENT_USER") + 1)
ElseIf Left(sRegRoot,Len("HKEY_CURRENT_USER")) = "HKEY_CURRENT_USER" Then
sNewRoot = HKEY_CURRENT_USER
sPartialPath = Replace(sRegRoot,"HKEY_CURRENT_USER",1, Len("HKEY_CURRENT_USER") + 1)
'HKEY_LOCAL_MACHINE
'
ElseIf Left(sRegRoot,Len("HKLM")) = "HKLM" Then
sNewRoot = HKEY_LOCAL_MACHINE
sPartialPath = Replace(sRegRoot,"HKLM",1, Len("HKLM") + 1)
ElseIf Left(sRegRoot,Len("HKLM")) = "HKLM" Then
sNewRoot = HKEY_LOCAL_MACHINE
sPartialPath = Replace(sRegRoot,"HKLM",1, Len("HKLM") + 1)
ElseIf Left(sRegRoot,Len("HKEY_LOCAL_MACHINE")) = "HKEY_LOCAL_MACHINE" Then
sNewRoot = HKEY_LOCAL_MACHINE
sPartialPath = Replace(sRegRoot,"HKEY_LOCAL_MACHINE",1, Len("HKEY_LOCAL_MACHINE") + 1)
ElseIf Left(sRegRoot,Len("HKEY_LOCAL_MACHINE")) = "HKEY_LOCAL_MACHINE" Then
sNewRoot = HKEY_LOCAL_MACHINE
sPartialPath = Replace(sRegRoot,"HKEY_LOCAL_MACHINE",1, Len("HKEY_LOCAL_MACHINE") + 1)
'HKEY_USERS
'
ElseIf Left(sRegRoot,Len("HKEY_USERS")) = "HKEY_USERS" Then
sNewRoot = HKEY_USERS
sPartialPath = Replace(sRegRoot,"HKEY_USERS",1, Len("HKEY_USERS") + 1)
ElseIf Left(sRegRoot,Len("HKEY_USERS")) = "HKEY_USERS" Then
sNewRoot = HKEY_CURRENT_MACHINE
sPartialPath = Replace(sRegRoot,"HKEY_USERS",1, Len("HKEY_USERS") + 1)
'HKEY_CLASSES_ROOT
'
ElseIf Left(sRegRoot,Len("HKEY_CLASSES_ROOT")) = "HKEY_CLASSES_ROOT" Then
sNewRoot = HKEY_CLASSES_ROOT
sPartialPath = Replace(sRegRoot,"HKEY_CLASSES_ROOT",1, Len("HKEY_CLASSES_ROOT") + 1)
ElseIf Left(sRegRoot,Len("HKEY_CLASSES_ROOT")) = "HKEY_CLASSES_ROOT" Then
sNewRoot = HKEY_CURRENT_MACHINE
sPartialPath = Replace(sRegRoot,"HKEY_CLASSES_ROOT",1, Len("HKEY_CLASSES_ROOT") + 1)
'HKEY_CURRENT_CONFIG
'
ElseIf Left(sRegRoot,Len("HKEY_CURRENT_CONFIG")) = "HKEY_CURRENT_CONFIG" Then
sNewRoot = HKEY_CURRENT_CONFIG
sPartialPath = Replace(sRegRoot,"HKEY_CURRENT_CONFIG",1, Len("HKEY_CURRENT_CONFIG") + 1)
ElseIf Left(sRegRoot,Len("HKEY_CURRENT_CONFIG")) = "HKEY_CURRENT_CONFIG" Then
sNewRoot = HKEY_CURRENT_MACHINE
sPartialPath = Replace(sRegRoot,"HKEY_CURRENT_CONFIG",1, Len("HKEY_CURRENT_CONFIG") + 1)
End If
GetRegRootToUseForBinaryValues = Array(sNewRoot,sPartialPath)
End Function
Function DecimalNumbers(arrHex)
On Error Resume Next
' from: http://www.petri.co.il/forums/showthread.php?t=46158
Dim i, strDecValues
For i = 0 to Ubound(arrHex)
If isEmpty(strDecValues) Then
strDecValues = CLng("&H" & arrHex(i))
Else
strDecValues = strDecValues & "," & CLng("&H" & arrHex(i))
End If
Next
DecimalNumbers = split(strDecValues, ",")
End Function
Function GetDefaultUserPath
On Error Resume Next
Dim objRegistry
Dim strKeyPath
Dim strDefaultUser
Dim strDefaultPath
Dim strResult
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!.rootdefault:StdRegProv")
strKeyPath = "SOFTWAREMicrosoftWindows NTCurrentVersionProfileList"
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,"DefaultUserProfile",strDefaultUser
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,"ProfilesDirectory",strDefaultPath
If Len(strDefaultUser) < 1 or IsEmpty(strDefaultUser) or IsNull(strDefaultUser) Then
'must be on Vista or newer
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,"Default",strDefaultPath
strResult = strDefaultPath
Else
'must be on XP
strResult = strDefaultPath & "" & strDefaultUser
End If
GetDefaultUserPath = strResult
End Function
Function RetrieveUsernameFromPath(sTheProfilePath)
On Error Resume Next
Dim lstPath
Dim sTmp
Dim sUsername
lstPath = Split(sTheProfilePath,"")
For each sTmp in lstPath
sUsername = sTmp
'last split is our username
Next
RetrieveUsernameFromPath = sUsername
End Function
Sub LoadProfileHive(sProfileDatFilePath, sCurrentUser, DAT_FILE)
On Error Resume Next
Dim intResultLoad, intResultUnload, sUserSID
'Load user's HKCU into temp area under HKLM
intResultLoad = WshShell.Run("reg.exe load " & RegRoot & " " & chr(34) & sProfileDatFilePath & chr(34), 0, True)
If intResultLoad <> 0 Then
' This profile appears to already be loaded...lets update it under the HKEY_USERS hive
Dim objRegistry2, objSubKey2
Dim strKeyPath2, strValueName2, strValue2
Dim strSubPath2, arrSubKeys2
Set objRegistry2 = GetObject("winmgmts:.rootdefault:StdRegProv")
strKeyPath2 = "SOFTWAREMicrosoftWindows NTCurrentVersionProfileList"
objRegistry2.EnumKey HKEY_LOCAL_MACHINE, strKeyPath2, arrSubkeys2
sUserSID = ""
For Each objSubkey2 In arrSubkeys2
strValueName2 = "ProfileImagePath"
strSubPath2 = strKeyPath2 & "" & objSubkey2
objRegistry2.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath2,strValueName2,strValue2
If Right(UCase(strValue2),Len(sCurrentUser)+1) = "" & UCase(sCurrentUser) Then
'this is the one we want
sUserSID = objSubkey2
End If
Next
If Len(sUserSID) > 1 Then
WScript.Echo " Updating another logged-on user: " & sCurrentUser & vbCrLf
If DAT_FILE = DAT_NTUSER Then
Call KeysToModify("HKEY_USERS" & sUserSID, DAT_FILE)
ElseIf DAT_FILE = DAT_USRCLASS Then
Call KeysToModify("HKEY_USERS" & sUserSID & "_Classes", DAT_FILE)
End If
Else
WScript.Echo(" *** An error occurred while loading HKCU for this user: " & sCurrentUser)
End If
Else
WScript.Echo(" HKCU loaded for this user: " & sCurrentUser)
End If
''
If sUserSID = "" then 'check to see if we just updated this user b/c they are already logged on
Call KeysToModify(RegRoot, DAT_FILE) ' update registry settings for this selected user
End If
''
If sUserSID = "" then 'check to see if we just updated this user b/c they are already logged on
intResultUnload = WshShell.Run("reg.exe unload " & RegRoot,0, True) 'Unload HKCU from HKLM
If intResultUnload <> 0 Then
WScript.Echo(" *** An error occurred while unloading HKCU for this user: " & sCurrentUser & vbCrLf)
Else
WScript.Echo(" HKCU UN-loaded for this user: " & sCurrentUser & vbCrLf)
End If
End If
End Sub
Function GetUserRunningScript()
On Error Resume Next
Dim sUserRunningScript, sComputerName
sUserRunningScript = WshShell.ExpandEnvironmentStrings("%USERNAME%") 'Holds name of current logged on user running this script
sComputerName = UCase(WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%"))
If sUserRunningScript = "%USERNAME%" or sUserRunningScript = sComputerName & "$" Then
' This script might be run by the SYSTEM account or a service account
Dim sTheProfilePath
sTheProfilePath = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") 'Holds name of current logged on user running this script
sUserRunningScript = RetrieveUsernameFromPath(sTheProfilePath)
End If
GetUserRunningScript = sUserRunningScript
End Function
Function RemoveTrailingPathDelimiter(sPath)
On Error Resume Next
Dim sUpdatedPath
sUpdatedPath = sPath
If Right(sUpdatedPath,1) = "" Then
sUpdatedPath = Left(sUpdatedPath,Len(sUpdatedPath)-1)
End If
RemoveTrailingPathDelimiter = sUpdatedPath
End Function
Function GetPathToDatFileToUpdate(sProfilePath, DAT_FILE)
On Error Resume Next
Dim sDatFile, sPathToDat, sTrimmedProfilePath
Dim bFoundDatFile
sPathToDat = "" 'default
sTrimmedProfilePath = RemoveTrailingPathDelimiter(sProfilePath)
If DAT_FILE = DAT_NTUSER Then
sDatFile = "NTUSER.DAT"
If objFSO.FileExists(sTrimmedProfilePath & "" & sDatFile) or objFSO.FileExists(chr(34) & sTrimmedProfilePath & "" & sDatFile & chr(34)) Then
sPathToDat = sTrimmedProfilePath & "" & sDatFile
End If
ElseIf DAT_FILE = DAT_USRCLASS Then
sDatFile = "USRCLASS.DAT"
If objFSO.FileExists(sTrimmedProfilePath & "AppDataLocalMicrosoftWindows" & sDatFile) OR _
objFSO.FileExists(chr(34) & sTrimmedProfilePath & "AppDataLocalMicrosoftWindows" & sDatFile & chr(34)) Then
sPathToDat = sTrimmedProfilePath & "AppDataLocalMicrosoftWindows" & sDatFile
ElseIf objFSO.FileExists(sTrimmedProfilePath & "Local SettingsApplication DataMicrosoftWindows" & sDatFile) OR _
objFSO.FileExists(chr(34) & sTrimmedProfilePath & "Local SettingsApplication DataMicrosoftWindows" & sDatFile & chr(34)) Then
sPathToDat = sTrimmedProfilePath & "Local SettingsApplication DataMicrosoftWindows" & sDatFile
End If
End If
GetPathToDatFileToUpdate = sPathToDat
End Function
Sub Load_Registry_For_Each_User(DAT_FILE)
On Error Resume Next
Dim sUserRunningScript
Dim objRegistry, objSubkey
Dim strKeyPath, strValueName, strValue, strSubPath, arrSubKeys
Dim sCurrentUser, sProfilePath, sNewUserProfile
Dim sPathToDatFile
sUserRunningScript = GetUserRunningScript
WScript.Echo "Updating the logged-on user: " & sUserRunningScript & vbCrLf
''
If DAT_FILE = DAT_NTUSER Then
Call KeysToModify("HKCU", DAT_FILE) 'Update registry settings for the user running the script
ElseIf DAT_FILE = DAT_USRCLASS Then
Call KeysToModify("HKCR", DAT_FILE) 'Update registry settings for the user running the script
End If
''
sNewUserProfile = GetDefaultUserPath
sPathToDatFile = GetPathToDatFileToUpdate(sNewUserProfile, DAT_FILE)
If Len(sPathToDatFile) > 0 Then
WScript.Echo "Updating the DEFAULT user profile which affects newly created profiles." & vbCrLf
Call LoadProfileHive(sPathToDatFile, "Default User Profile", DAT_FILE)
Else
WScript.Echo "Unable to update the DEFAULT user profile, because it could not be found at: " _
& vbCrLf & sPathToDatFile & vbCrLf
End If
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!.rootdefault:StdRegProv")
strKeyPath = "SOFTWAREMicrosoftWindows NTCurrentVersionProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
strValueName = "ProfileImagePath"
strSubPath = strKeyPath & "" & objSubkey
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue
sProfilePath = strValue
sCurrentUser = RetrieveUsernameFromPath(strValue)
If ((UCase(sCurrentUser) <> "ALL USERS") and _
(UCase(sCurrentUser) <> UCase(sUserRunningScript)) and _
(UCase(sCurrentUser) <> "LOCALSERVICE") and _
(UCase(sCurrentUser) <> "SYSTEMPROFILE") and _
(UCase(sCurrentUser) <> "NETWORKSERVICE")) then
sPathToDatFile = GetPathToDatFileToUpdate(sProfilePath, DAT_FILE)
If Len(sPathToDatFile) > 0 Then
WScript.Echo "Preparing to update the user: " & sCurrentUser
Call LoadProfileHive(sPathToDatFile, sCurrentUser, DAT_FILE)
End If
End If
Next
End Sub
Configuration Manager Packaging
- Extract the contents of the ZIP file in the library location of your Configuration Manager.
- Open the Configuration Manager console and navigate to Software LibraryOverviewApplication ManagementApplications.
Right-click on the Applications option and select Create Application.
- Select Manually specify the application information then click on Next
- Define a name and click on Next
- Leave the default values and click on Next
- In Deployment Types, click on Add
- Change Type to Script Installer and click on Next
- Define a name and click on Next
- Define the Content Location, select “SetupTeams.ps1” as the Installation program and click on Next
- Click on the Add Clause button
- Select type as Registry
- Then select the HKEY_LOCAL_MACHINE hive
- Type in the key SOFTWAREMicrosoftWindowsCurrentVersionUninstallRemendar
- Type in the value Microsoft Teams
- In Data Type select String
- Select This registry settting must satisfy the following rule to indicate the presence of this application
- In Operator select Equals
- And in Value type in Rem_1.0
- Click OK
- Click on Next
- For Installation behaviour, select Install for system
- In Logon requirement select Whether or not a user is logged on
- In Installation program visibility select Hidden
- In Maximum allowed run time type in 15
- In Estimated installation time type in 5
- Click on Next
- In Requirements, leave as it is and click on Next
- In Dependencies, just click on Next
- Click on Next in Summary
- Click on Close at the end
- Click on Next
- Click on Next in Summary
- Click on Close at the Completion
Deploy and distribute your package into a test collection before deploying to production.
Always test and re-test your package before releasing it into production.