19. januar 2026

Afinstaller Internet Explorer - fra kommandoprompt / Powershell



Kør som admin

Virker på f.eks. Server 2016




dism /online /disable-feature /featurename:Internet-Explorer-Optional-amd64



M365 - Connect til det meste

 # Connect til det meste


#31.08.2023 - Rob: Første version



DO {


    Write-Host '#############################################'

    Write-Host '# Hvad vil du connecte til?                 #'

    Write-Host '# A: Azure AD (MsolService)                 #'

    Write-Host '# E: Exchange Online                        #'

    Write-Host '# S: SharePoint                             #'

    Write-Host '# C: Security & Compliance PowerShell       #'

    Write-Host '# T: Microsoft Teams                        #'

    Write-Host '#############################################'


    $Valg = Read-Host "Vælg et bogstav. Tryk retur for Exit"




    #$credential = Get-Credential


    if ( $Valg -eq "A" ) #Azure AD

        {

        $credential = Get-Credential

        Connect-AzureAD -Credential $credential

        Connect-MsolService -Credential $credential

        }


    if ( $Valg -eq "E" ) #Exchange Online

        {

       # Connect til det meste


#31.08.2023 - Rob: Første version



DO {


    Write-Host '#############################################'

    Write-Host '# Hvad vil du connecte til?                 #'

    Write-Host '# A: Azure AD (MsolService)                 #'

    Write-Host '# E: Exchange Online                        #'

    Write-Host '# S: SharePoint                             #'

    Write-Host '# C: Security & Compliance PowerShell       #'

    Write-Host '# T: Microsoft Teams                        #'

    Write-Host '#############################################'


    $Valg = Read-Host "Vælg et bogstav. Tryk retur for Exit"




    #$credential = Get-Credential


    if ( $Valg -eq "A" ) #Azure AD

        {

        $credential = Get-Credential

        Connect-AzureAD -Credential $credential

        Connect-MsolService -Credential $credential

        }


    if ( $Valg -eq "E" ) #Exchange Online

        {

        $msalPath = [System.IO.Path]::GetDirectoryName((Get-Module ExchangeOnlineManagement).Path);

Add-Type -Path "$msalPath\Microsoft.IdentityModel.Abstractions.dll";

Add-Type -Path "$msalPath\Microsoft.Identity.Client.dll";

[Microsoft.Identity.Client.IPublicClientApplication] $application = [Microsoft.Identity.Client.PublicClientApplicationBuilder]::Create("fb78d390-0c51-40cd-8e17-fdbfab77341b").WithDefaultRedirectUri().Build();

$result = $application.AcquireTokenInteractive([string[]]"https://outlook.office365.com/.default").ExecuteAsync().Result;

Connect-ExchangeOnline -AccessToken $result.AccessToken -UserPrincipalName $result.Account.Username; 

        }



    if ( $Valg -eq "S" ) #SharePoint

        {

        Import-Module Microsoft.Online.SharePoint.PowerShell

        Write-Host "Nu skal du skrive URL på SharePoint ADMIN på den Tenant du vil arbejde med (eksempelvis: https://consensusit-admin.sharepoint.com)"

        Connect-SPOService

        }




    if ( $Valg -eq "C" ) #Security & Compliance

        {

        Connect-IPPSSession

        }



    if ( $Valg -eq "T" ) #Teams

        {

        $credential = Get-Credential

        Import-Module MicrosoftTeams

        Connect-MicrosoftTeams -Credential $credential

        }


} While ($Valg -ne "")

        }



    if ( $Valg -eq "S" ) #SharePoint

        {

        Import-Module Microsoft.Online.SharePoint.PowerShell

        Write-Host "Nu skal du skrive URL på SharePoint ADMIN på den Tenant du vil arbejde med (eksempelvis: https://consensusit-admin.sharepoint.com)"

        Connect-SPOService

        }




    if ( $Valg -eq "C" ) #Security & Compliance

        {

        Connect-IPPSSession

        }



    if ( $Valg -eq "T" ) #Teams

        {

        $credential = Get-Credential

        Import-Module MicrosoftTeams

        Connect-MicrosoftTeams -Credential $credential

        }


} While ($Valg -ne "")

20. februar 2025

Tildel en bruger rettigheder til undermapper i delt postkasse

Connect først 



$Username = "postkasse@domain.dk" 

$AddUsername = "bruger@domain.dk" 

$CustomFolder = Get-MailboxFolderStatistics -Identity $Username -FolderScope All | Where-Object {$_.FolderPath -like '/Indbakke/Undermappe*'} 

foreach ($CustomSubFolder in $CustomFolder) { Add-MailboxFolderPermission -Identity "$($Username):$($CustomSubFolder.FolderPath.Replace("/","\"))" -User $AddUsername -AccessRights Owner }

Exchange Online Management PowerShell Connect-ExchangeOnline bug "A window handle must be configured

SOLVED: Exchange Online Management PowerShell Connect-ExchangeOnline bug "A window handle must be configured. See https://aka.ms/msal-net-wam#parent-window-handles" 

 

 

 

Workaround 3: Handle MSAL Authentication yourself 

The best solution is to handle the MSAL authentication yourself and then pass an access token to Connect-ExchangeOnline. The Exchange team are constantly shunning standards (the whole backend of these cmdlets are a botched REST API that passes the cmdlet name) so you're really stuck with the cmdlets but you can at least rid yourself of their authentication code. 

 

The following sample code uses the MSAL libraries that are installed as part of the Exchange PowerShell cmdlets so you don't need to install these separately. 

$msalPath = [System.IO.Path]::GetDirectoryName((Get-Module ExchangeOnlineManagement).Path); 
Add-Type -Path "$msalPath\Microsoft.IdentityModel.Abstractions.dll"; 
Add-Type -Path "$msalPath\Microsoft.Identity.Client.dll"; 
[Microsoft.Identity.Client.IPublicClientApplication] $application = [Microsoft.Identity.Client.PublicClientApplicationBuilder]::Create("fb78d390-0c51-40cd-8e17-fdbfab77341b").WithDefaultRedirectUri().Build(); 
$result = $application.AcquireTokenInteractive([string[]]"https://outlook.office365.com/.default").ExecuteAsync().Result; 
Connect-ExchangeOnline -AccessToken $result.AccessToken -UserPrincipalName $result.Account.Username