Connection Timeout

I need to increase the connection timeout value on a large number of Linux Assets and have been provided with the below powershell.

Connect-Safeguard -Appliance ip_address_safeguard -Insecure -Gui -Verbose

 

#Array of assets to update

$AssetsToUpdate = "asset1","asset2"

 

ForEach ($i in $AssetsToUpdate)

{

$asset = Get-SafeguardAsset -AssetToGet $i $asset.ConnectionProperties.CommandTimeout = 120 $id = $asset.Id invoke-safeguardmethod core put "Assets/$id" -Body $asset

}

This is returns the below error:

+ $asset = Get-SafeguardAsset -AssetToGet $i $asset.ConnectionPropertie ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-SafeguardAsset], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Get-SafeguardAsset

Parents
  • First line of error:

    Get-SafeguardAsset : A positional parameter cannot be found that accepts argument '$null'.

  • Hi Keiron,

    I was able to run the script successfully but instead of having the code between the brackets on one line, I placed each variable on a separate line as shown below:

    Connect-Safeguard -Appliance  ip_address_safeguard -Insecure -Gui -Verbose
    
    #Array of assets to update
    
    $AssetsToUpdate = "asset1","asset2"
    
    ForEach ($i in $AssetsToUpdate)
    
    {
    
    $asset = Get-SafeguardAsset -AssetToGet $i 
    $asset.ConnectionProperties.CommandTimeout = 120
    $id = $asset.Id 
    invoke-safeguardmethod core put "Assets/$id" -Body $asset
    
    }

    Thanks!

Reply
  • Hi Keiron,

    I was able to run the script successfully but instead of having the code between the brackets on one line, I placed each variable on a separate line as shown below:

    Connect-Safeguard -Appliance  ip_address_safeguard -Insecure -Gui -Verbose
    
    #Array of assets to update
    
    $AssetsToUpdate = "asset1","asset2"
    
    ForEach ($i in $AssetsToUpdate)
    
    {
    
    $asset = Get-SafeguardAsset -AssetToGet $i 
    $asset.ConnectionProperties.CommandTimeout = 120
    $id = $asset.Id 
    invoke-safeguardmethod core put "Assets/$id" -Body $asset
    
    }

    Thanks!

Children