none
O365 script removing User account and license from CSV of samaccountname RRS feed

  • Question

  • Could you please advise of a script to accomplish pulling Samaccountname from CSV and removing O365 user account and license. Here is what I've been trying without success, kind of stuck.

            $UserCredential = Get-Credential
            $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication  Basic -AllowRedirection
            Import-PSSession $Session
    
        $Names = Get-Content "C:\export\nameoffile.csv" 
        Set-MsolUserLicense -DisplayName $Names -RemoveLicenses *
    


    • Moved by Bill_Stewart Tuesday, December 11, 2018 11:20 PM This is not "scripts on demand"
    Thursday, August 2, 2018 6:51 PM

All replies