To avoid unexpected timeouts, you can run Set-PowerCLIConfiguration to modify the PowerCLI settings for long-running Web tasks.

You might want to change the PowerCLI setting for long-running Web tasks to avoid unexpected timeouts. The default value for the WebOperationTimeoutSeconds setting is 300 seconds.

Prerequisites

Verify that you are connected to a vCenter Server system.

Procedure

  1. (Optional) Learn more about what settings you can configure with Set-PowerCLIConfiguration.
    Get-Help Set-PowerCLIConfiguration
  2. Store the value of the timeout setting for the current session in the $initialTimeout variable.
    $initialTimeout = (Get-PowerCLIConfiguration -Scope Session).WebOperationTimeoutSeconds
  3. Set the timeout setting for the current session to 30 minutes.
    Set-PowerCLIConfiguration -Scope Session -WebOperationTimeoutSeconds 1800
  4. Run your Web task.
    • You can run an esxcli command to install a software profile.
      $vmHost = Get-VMHost "vmHostIp"
      $esxcli = Get-EsxCli -VMHost $vmHost -V2
      $arguments = $esxcli.software.profile.install.CreateArgs()
      $arguments.depot = "http://mysite.com/publish/proj/index.xml"
      $arguments.profile = "proj-version"
      $esxcli.software.profile.install.Invoke($arguments)
    • Alternatively, you can directly specify the arguments hash table in-line.
      $vmHost = Get-VMHost "vmHostIp"
      $esxcli = Get-EsxCli -VMHost $vmHost -V2
      $esxcli.software.profile.install.Invoke(@{depot="http://mysite.com/publish/proj/index.xml"; profile="proj-version"})
    Note: The two examples use the ESXCLI V2 interface of PowerCLI.
  5. Revert the timeout setting for the current session to the initial value.
    Set-PowerCLIConfiguration -Scope Session -WebOperationTimeoutSeconds $initialTimeout