Fixed by Microsoft Now
Powershell
if(-not (Get-Module Microsoft.Graph.Authentication -ListAvailable)){
Install-Module Microsoft.Graph.Authentication
}
if(-not (Get-Module Microsoft.Graph.Beta.DeviceManagement.Actions -ListAvailable)){
Install-Module Microsoft.Graph.Beta.DeviceManagement.Actions
}
# Import the necessary module
Import-Module Microsoft.Graph.Authentication
Import-Module Microsoft.Graph.Beta.DeviceManagement.Actions
# Authenticate with an MFA enabled account
Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All"
#get all the profile ids
# Define the initial URL for the query
$url = "https://graph.microsoft.com/beta/deviceManagement/windowsDriverUpdateProfiles/"
# Use Invoke-MgGraphRequest to send a GET request to the specified URL and get the response
$response = Invoke-MgGraphRequest -Uri $url -Method GET
foreach ($driverprofile in $response.value) {
# Get the id for the current item
$driverprofileid = $driverprofile.id
# Define the initial URL for the query
$url = "https://graph.microsoft.com/beta/deviceManagement/windowsDriverUpdateProfiles/$driverprofileid/driverInventories?$filter=category+eq+'other'+and+approvalstatus+eq+'needsreview'"
do {
# Use Invoke-MgGraphRequest to send a GET request to the specified URL and get the response
$response2 = Invoke-MgGraphRequest -Uri $url -Method GET
# Loop through each item in the 'value' property of the response
foreach ($item in $response2.value) {
# Get the id for the current item
$id = $item.id
# Define the parameters for the Invoke-MgBetaExecuteDeviceManagementWindowsDriverUpdateProfileAction command
$params = @{
actionName = "Approve"
driverIds = @(
$id
)
#deploymentDate = [System.DateTime]::Parse("2023-11-30T23:00:00.000Z")
deploymentDate = Get-Date
}
# Invoke the command with the specified parameters
Invoke-MgBetaExecuteDeviceManagementWindowsDriverUpdateProfileAction -WindowsDriverUpdateProfileId $driverprofileid -BodyParameter $params
}
# Get the next page link
$url = $response2.'@odata.nextLink'
} while ($null -ne $url) # Continue as long as there's a next page link
}
#Disconnect Graph
Disconnect-Graph