diff --git a/Segment/Asset Management/Add-AssetsToLearning.ps1 b/Segment/Asset Management/Add-AssetsToLearning.ps1 index e46e6ee..520dfe7 100644 --- a/Segment/Asset Management/Add-AssetsToLearning.ps1 +++ b/Segment/Asset Management/Add-AssetsToLearning.ps1 @@ -7,6 +7,7 @@ $file = "PATH_TO_FILE.txt" $adDomain = "YOUR_DOMAIN.com" # how many days you want to learn. $daysToLearn = 30 +$$maintenanceWindowId "e:m:rsij1N89" # check for zero networks powershell module if(get-module ZeroNetworks -ListAvailable){ @@ -29,4 +30,15 @@ foreach($host in $hosts){ $items += "$assetId" } -Invoke-ZNAssetNetworkQueue -items $items -QueueDays $daysToLearn +#Invoke-ZNAssetNetworkQueue -items $items -QueueDays $daysToLearn +#with Maintenance Window +$znHeaders = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" +$znHeaders.Add("Authorization",$apiToken) +$znHeaders.Add("Content-Type","application/json") +$body = @{ + "items" = $items + "queueDays" = $daysToLearn + "enforceBlocks" = $false + "maintenanceWindowId" = $maintenanceWindowId +} +Invoke-RestMethod -uri "https://portal.zeronetworks.com/api/v1/assets/actions/queue" -method POST -Headers $znHeaders -Body @body