Set-OutlookProfilePrompt

This commit is contained in:
2024-08-23 11:18:44 -04:00
parent efea29ac95
commit 8e0e3711f7
+14
View File
@@ -1135,6 +1135,20 @@ Function Get-StringHash() {
$hashObj.Hash
}
# Function to enable or disable the profile prompt when launching Outlook
Function Set-OutlookProfilePrompt () {
param(
[Parameter(ValueFromPipeline=$false,Mandatory=$true,ParameterSetName='enable')][switch]$Enable,
[Parameter(ValueFromPipeline=$false,Mandatory=$true,ParameterSetName='disable')][switch]$Disable
)
If ( $Enable ) { $val = '1' ; $action = "Enabling"}
If ( $Disable ) { $val = '0' ; $action = "Disabling"}
Write-Output "${action} profile picker on Outlook launch"
[Microsoft.Win32.Registry]::SetValue('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Exchange\Client\Options','PickLogonProfile',$val,[Microsoft.Win32.RegistryValueKind]::String)
$Profiles = (Get-ChildItem -Path 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles' | Select-Object -ExpandProperty Name | Split-Path -Leaf | Sort-Object) -join "`n"
Write-Output "Available Outlook profiles:`n${Profiles}"
}
# Initial setup of the MSP management directories and log file
Setup-MSPDirectories
Setup-LogFile