Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepowershell
titleExample for use of PowerShell cmdlets
linenumberstrue
#!/usr/bin/env pwsh

# Parameterization

$Url = "http://localhost:4446"
$ControllerId = "controller"

$TestCaseAgentId    = "TestCase_AgentID"
$TestCaseAgentName  = "TestCase_AgentName"
$TestCaseAgentUrl  = "http://TestCase_AgentUrl"

# Connection

Import-Module JS7 -Force
Connect-JS7 -Url $Url -Id $ControllerId | Out-Null

# ----- createCreate Standalone Agents -----

# store Agent configuration to inventory
Set-JS7Agent -AgentId "$TestCaseAgentId-001" -AgentName "$TestCaseAgentName-001" -Url "$TestCaseAgentUrl-001:4443" -ControllerId $ControllerId
Set-JS7Agent -AgentId "$TestCaseAgentId-002" -AgentName "$TestCaseAgentName-002" -Url "$TestCaseAgentUrl-002:4443" -ControllerId $ControllerId

# ----- manageManage Standalone Agents -----

# storeread Agent configurations tofrom inventory
$agent1 = Get-JS7Agent -AgentId "$TestCaseAgentId-001"
$agent2 = Get-JS7Agent -AgentId "$TestCaseAgentId-002"

# deploy Agents to Controller
Publish-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# reset Agents if required
Reset-JS7Agent -AgentId "$TestCaseAgentId-001"
Reset-JS7Agent -AgentId "$TestCaseAgentId-001" -Force

# disable Agents that should not be considered for job execution
Disable-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# hide Agents that should not be considered for assignment to jobs
Hide-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# make hidden Agents visible again
Show-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# enable Agents
Enable-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# ----- removeRemove Standalone Agents -----

Remove-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002"

# Connection

Disconnect-JS7

...