forked from RyanC92/Powershell-Repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRemove-Licenses-CSV.ps1
23 lines (15 loc) · 1.31 KB
/
Remove-Licenses-CSV.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Write-Host "This will Remove All Licenses For Users Provided VIA CSV"
$CSVPath = Read-Host "Please Paste the full path to the CSV file (Including the file itself)"
$Option = Read-Host "1 To Remove User Licenses"
if($Option -eq "1"){
Import-CSV $CSVPath | foreach-Object { Set-MsolUserLicense -UserPrincipalName $_.email -RemoveLicenses "EXCELSIORMEDICAL:VISIOCLIENT" }
Import-CSV $CSVPath | foreach-Object { Set-MsolUserLicense -UserPrincipalName $_.email -RemoveLicenses "EXCELSIORMEDICAL:PROJECTCLIENT" }
Import-CSV $CSVPath | foreach-Object { Set-MsolUserLicense -UserPrincipalName $_.email -RemoveLicenses "EXCELSIORMEDICAL:EXCHANGEDESKLESS" }
Import-CSV $CSVPath | foreach-Object { Set-MsolUserLicense -UserPrincipalName $_.email -RemoveLicenses "EXCELSIORMEDICAL:EXCHANGESTANDARD" }
Import-CSV $CSVPath | foreach-Object { Set-MsolUserLicense -UserPrincipalName $_.email -RemoveLicenses "EXCELSIORMEDICAL:OFFICESUBSCRIPTION" }
Import-CSV $CSVPath | foreach-Object { Set-MsolUserLicense -UserPrincipalName $_.email -RemoveLicenses "EXCELSIORMEDICAL:EXCHANGEARCHIVE" }
Import-CSV $CSVPath | foreach-Object { Set-MsolUserLicense -UserPrincipalName $_.email -RemoveLicenses "EXCELSIORMEDICAL:O365_BUSINESS" }
}
elseif($Option -ne "1"){
Write-Host "No Changes Were Made, Be More Careful Next Time."
}