Bulk Assign License user & add proxy address
Assign License user
Here are step-by-step instructions for executing the PowerShell script to bulk assign licenses and add proxy addresses:
Bulk Assign Licenses:
- Prepare the CSV file:
- Create a CSV file named “license-basic.csv” with the following columns: UserPrincipalName, UsageLocation, SKU.
- Populate the CSV file with user information, providing the UserPrincipalName, UsageLocation, and SKU values for each user.
- Open PowerShell:
- Open the PowerShell console or PowerShell Integrated Scripting Environment (ISE) on your computer.
- Set Execution Policy:
- If you haven’t already, you may need to set the PowerShell Execution Policy to allow script execution. Run the following command:
Set-ExecutionPolicy RemoteSigned
- Choose ‘Y’ or ‘A’ to confirm the change.
- Change to the appropriate directory:
- Use the
cd
command to navigate to the directory where the script and CSV file are located. For example:
cd "D:\Path\to\script"
- Execute the script:
- Run the following command to execute the script and bulk assign licenses:
$users = import-csv "D:\license-basic.csv" -delimiter "," foreach ($user in $users) { $upn = $user.UserPrincipalName $usagelocation = $user.usagelocation $SKU = $user.SKU $content = "Assignlisence" + ":" + $upn Write-host $content Set-MsolUser -UserPrincipalName $upn -UsageLocation $usagelocation Set-MsolUserLicense -UserPrincipalName $upn -AddLicenses $SKU }
- Monitor the script’s output:
- The script will iterate through each user and display a message for each assignment.
- Monitor the console output for any errors or confirmation messages.
Add Proxy Addresses:
- Prepare the CSV file:
- Create a CSV file named “proxy.csv” with two columns: Name and Proxyaddresses.
- Populate the CSV file with the desired user names and corresponding proxy addresses.
- Open PowerShell:
- Open the PowerShell console or PowerShell Integrated Scripting Environment (ISE) on your computer.
- Change to the appropriate directory:
- Use the
cd
command to navigate to the directory where the script and CSV file are located. For example:
cd "C:\Path\to\script"
- Execute the script:
- Run the following command to execute the script and add proxy addresses:
Import-CSV "C:\proxy.csv" | foreach { Set-ADUser -Identity $_.Name -Add @{Proxyaddresses=$_.Proxyaddresses} }
- Monitor the script’s output:
- The script will iterate through each row in the CSV file and add the specified proxy addresses to the corresponding users.
- Monitor the console output for any errors or confirmation messages.
Remember to adjust the file paths in the scripts to match the actual locations of the CSV files on your system. Also, ensure that you have the necessary permissions and the required PowerShell modules installed to execute these commands.