Skip to content

Commit

Permalink
Update Add-AssetsToLearning.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
dicolanl authored Oct 4, 2024
1 parent 53ddd46 commit a68c9b8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Segment/Asset Management/Add-AssetsToLearning.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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

0 comments on commit a68c9b8

Please sign in to comment.