Install Orion Agent with Invoke-SwisVerb

I am trying to install an Orion Agent with following code.  


Invoke-SwisVerb -swisconnection $swis -entityName Orion.AgentManagement.Agent -verb Deploy -arguments @(
$engineId,`
$agentName,`
$hostname,`
$machineUsername,`
$machinePassword, `
$Ip)

I keep getting this error.  Any ideas?

Invoke-SwisVerb : Password can't be null
Parameter name: password

Parents Reply Children
  • hi   is it possible to share powershel script, i am trying same but getting following error,

    "Invoke-SwisVerb -SwisConnection $SwisConnection -EntityName "Orion.AgentManagement.Agent" -Verb "Deploy" -Arguments ($pollingEngineId,$agentName, $hostname,$ipAddress,$machineUserName,$machinePassword,$additionalUsername,$additionalPassword,$passwordIsPrivateKey,$privateKeyPassword,$agentMode,$installPackageFallbackId)
    "

     Invoke-SwisVerb : One or more errors occurred.

    At C:\Script-Tools\Deploy_of_agentbase_device.ps1:42 char:1
    + Invoke-SwisVerb -SwisConnection $SwisConnection -EntityName "Orion.Ag ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

  • He is the script I wrote minus any credential info

    <#
    # Load SwisPowerShell
    Import-Module SwisPowerShell
    
    # connect to SWIS - use your connection details and credentials
    $username = ""
    $password = ""
    $swis = Connect-Swis -Hostname <IP of Orion Server > -Credential ( Get-Credential -UserName $username -Message "Enter your Orion Credentials" )
    
    #>
    
    
    
    # =============================================================================
    # Windows or Linux machine - define just username and password
    # =============================================================================
    
    $servers = Get-content C:\<path to list of server >\Servers.txt
    
    
    $DebugPreference = 'SilentlyContinue'
    $ErrorActionPreference = "stop"
    
    foreach($server in $Servers)
        {
    try{   
    
    write-host "installing agent on $server " -ForegroundColor Yellow -BackgroundColor green
    
        $engineId = 1
        $agentName = "OrionAgent_PS_Install_$($server)"
        $hostname = "$($server)"
        $machineUsername = "<Domain Account>"
        $machinePassword = "<PWD>"
        $Ip = $hostname
    
    
    Invoke-SwisVerb -swisconnection $swis -entityName Orion.AgentManagement.Agent -verb  Deploy -arguments @(
        $engineId,`
        $agentName,`
        $hostname,`
        $Ip,`
        $machineUsername,`
        $machinePassword)
    
    } ##Try block
        catch [Exception] 
        {
    
           #General Failure
                Write-Host GENERAL FAILURE! for  $($hostname) -ForegroundColor Red
                <#When I want to know the full exception type:#>
                $errormessage =   $Error[0].Exception.Message  -replace "'",""  
                Write-Host $errormessage -BackgroundColor darkblue -ForegroundColor Red
        } ##Catch block
    } ##Foreach block