added my custom msp powershell scripts

This commit is contained in:
Lucca Pirovano
2026-07-07 16:34:11 -04:00
parent 61cdd43f50
commit a8d1f7321f
4 changed files with 102 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
#onboarding script
# v put the MSP's info here v #
$MSPName = "Example Company"
# ^ put the MSP's info here ^ #
# v put the client company's info here v #
$tenantID = "31537af4-6d77-4bb9-a681-d2394888ea26"
$clientCompanyEmailDomain = "contoso.onmicrosoft.com"
$clientCompanyName = "Contoso Corp"
# ^ put the client company's info here ^ #
# v put the user's info here v #
$userFirstName = ""
$userLastName = ""
$userMobilePhone = ""
$userState = "New Jersey"
$userDepartment = ""
$userUsageLocation = "US"
# ^ put their info here ^ #
$userMailNickname = $userFirstName.ToLower()[0]+$userLastName.ToLower()
$userDisplayName = "$userFirstName $userLastName"
$userEmail = "$userMailNickname@$clientCompanyEmailDomain"
Add-Type -AssemblyName System.Web
$password = [System.Web.Security.Membership]::GeneratePassword((Get-Random -Minimum 20 -Maximum 32), 3)
$PasswordProfile = @{
Password = $password
ForceChangePasswordNextSignIn = $true
ForceChangePasswordNextSignInWithMfa = $true
}
#connect to graph
Connect-MgGraph -NoWelcome -TenantId $tenantID
New-MgUser -AccountEnabled -GivenName $userFirstName -Surname $userLastName -MailNickname $userMailNickname -DisplayName $userDisplayName -UserPrincipalName $userEmail -PasswordProfile $PasswordProfile -Department $userDepartment -UsageLocation $userUsageLocation
$businesspremiumlicense = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'SPB'
Set-MgUserLicense -UserId $userEmail -AddLicenses @{SkuId = $businesspremiumlicense.SkuId} -RemoveLicenses @()
$fullName = ((Get-ItemProperty "HKCU:\\Software\\Microsoft\\Office\\Common\\UserInfo\\").UserName)
$firstName = $fullName.Split(' ')[0]
cls
echo "Hello, this is $firstName with $MSPName."
echo "`nI just created your Microsoft login information for $clientCompanyName:`n"
echo "Email: $userEmail"
echo "Temporary Password: $password"
echo "`nYou can sign in using the outlook or teams apps, or from portal.office.com"
echo "`nPlease let me know if you have any issues signing in, were happy to help!`n"
echo "Thank you and have a wonderful rest of your day,"
echo $fullName