microsoft / Intune-PowerShell-SDK

Native PowerShell support for invoking Microsoft Intune Graph API to enable IT Pro scenario automation.
MIT License
315 stars 77 forks source link

New-IntuneDeviceConfigurationPolicy Edm.TimeOfDay error #45

Open Vanarga opened 5 years ago

Vanarga commented 5 years ago

I'm trying to use the New-IntuneDeviceConfigurationPolicy. It works for most settings with the exception of defenderScheduledScanTime, defenderScheduledQuickScanTime where I get the following error:

image

What format do I need to enter the time in? I've tried quite a few and have been unsuccessful.

The format that produced that error was: $hash = @{ windows10GeneralConfiguration = $true passwordPreviousPasswordBlockCount = 10 defenderSystemScanSchedule = "sunday" defenderScheduledScanTime = "02:00:00.0000000" passwordMinimumCharacterSetCount = 4 defenderScanMaxCpu = 50 passwordExpirationDays = 90 description = "Windows 10 Configuration" passwordRequiredType = "alphanumeric" passwordMinimumLength = 10 passwordMinutesOfInactivityBeforeScreenTimeout = 15 defenderSignatureUpdateIntervalInHours = 24 defenderMonitorFileActivity = "monitorAllFiles" displayName = "Windows 10 Configuration" defenderScheduledQuickScanTime = "05:00:00.0000000" defenderScanType = "full" defenderDaysBeforeDeletingQuarantinedMalware = 7 }

New-IntuneDeviceConfigurationPolicy @hash

image

This did not work either: $hash.defenderScheduledScanTime = New-Timespan -Start "00:00:00.0000000" -end "02:00:00.0000000" $hash.defenderScheduledQuickScanTime = New-Timespan -Start "00:00:00.0000000" -end "05:00:00.0000000"

or

$hash.defenderScheduledScanTime = New-Timespan -Hours 2 $hash.defenderScheduledQuickScanTime = New-Timespan -Hours 5

Same error.

Vanarga commented 5 years ago

Just wanted to update this. Looks like the only value the command accepts is zero or any variation of zero as in New-Timespan 12AM or anything close to zero such as having less than 10000 milliseconds.

(get-date 12AM).TimeOfDay

Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : 0 Ticks : 0 TotalDays : 0 TotalHours : 0 TotalMinutes : 0 TotalSeconds : 0 TotalMilliseconds : 0

Vanarga commented 5 years ago

Just wanted to update this. I managed to get around it by using Invoke-MSGraphRequest. In fact, I used Invoke-MSGraphRequest to get around some other issues I noticed.