Skip to content

Commit

Permalink
add-assetstotaggroup
Browse files Browse the repository at this point in the history
  • Loading branch information
dicolanl authored Jun 27, 2024
1 parent 0519d48 commit 7908ce2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Segment/Asset Management/Add-AssetsToTagGroup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<#
.Synopsis
Batch adds assets to a Tag Group
.Description
This example will use the Zero Networks PowerShell module to import a csv of assets and batch add them to a specific tag group.
#>
$apiKey = ''
$assets = Import-CSV -Path "C:\path\to\assets.csv"
$groupId = 'g:t:xxxxxxxx'

if (-not(Get-Module -ListAvailable -Name ZeroNetworks)) {
Install-Module ZeroNetworks -scope CurrentUser
}

Import-Module ZeroNetworks

Set-ZNApiKey -ApiKey $apiKey

#Batch the assets into tag groups
$batch = 0
$counter = 0
$batchAssets = @()
while ($counter -le $assets.Count) {
$assetId = Search-ZNAsset -Fqdn $assets[$counter].Name
$batchAssets += $assetId
$counter++
$batch++
if($batch -eq 100){
Add-ZNTagGroupsMember -GroupId $groupId -MembersId $batchAssets
$batch = 0
$batchAssets = @()
}
}
6 changes: 6 additions & 0 deletions Segment/Identity Management/Add-ClientsToIdentityLearning.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<#
.Synopsis
Get a filtered list of clients ready for Identity Segment Learning and add to learning.
.Description
This example will use the Zero Networks PowerShell module to get all clients ready for identity learning and add them in batches to learning.
#>
$apiKey = ''

if (-not(Get-Module -ListAvailable -Name ZeroNetworks)) {
Expand Down

0 comments on commit 7908ce2

Please sign in to comment.