forsteri95 / script

0 stars 0 forks source link

Azure #1

Open forsteri95 opened 1 year ago

forsteri95 commented 1 year ago

Connect to the Microsoft Intune PowerShell module

Connect-MSGraph

Retrieve all profiles

$profiles = Get-IntuneDeviceConfiguration

Loop through each profile and display the name and description

foreach ($profile in $profiles) { Write-Host "Name: $($profile.displayName)" Write-Host "Description: $($profile.description)" }

This script first uses the Connect-MSGraph cmdlet to connect to the Microsoft Intune PowerShell module. It then uses the Get-IntuneDeviceConfiguration cmdlet to retrieve all profiles, and then loops through each profile using a foreach loop, displaying the name and description of each profile.

You may also want to try the same thing with Microsoft Graph API and use the appropriate endpoints and permissions to retrieve the profile information.

forsteri95 commented 1 year ago

@@ -0,0 +1,20 @@

Connect to Azure AD

Connect-AzureAD

Set variables for the group and license to be assigned

$groupName = "Group Name" $licenseName = "License Name"

Get the group object

$group = Get-AzureADGroup -SearchString $groupName

Get the license object

$license = Get-AzureADSubscribedSku | Where-Object {$_.SkuPartNumber -eq $licenseName}

Assign the license to the group

$licenseAssignment = New-AzureADGroupLicenseAssignment -ObjectId $group.ObjectId -SkuId $license.SkuId

You will need to replace the values for $groupName and $licenseName with the appropriate values for your environment.

Also, make sure you have the Azure AD PowerShell module installed and connect to Azure AD before running the script.