Configuring PowerCLI settings using the Set-PowerCLIConfiguration cmdlet is a straightforward process that can greatly enhance your PowerCLI experience. It has different options which can be read by reading the help of it. However, two most important in my point of view are DefaultVIServerMode and Scope.
- DefaultVIServerMode: Specifies the server connection mode. The new configuration takes effect immediately after you run the cmdlet. The following values are valid: Single, Multiple.
- Single – If no target servers are specified, cmdlets run only on the last connected server.
- Multiple – If no target servers are specified, cmdlets run on the servers in the variable.
- Scope: Specifies the scope of the setting that you want to modify. The parameter accepts Session, User and All Users values.
- Session – the setting is valid for the current VMware PowerCLI session only and overrides any User and All Users settings.
- User – the setting is valid for the current Windows user only, overrides All Users settings, and is applied only if a Session setting cannot be detected.
- All Users – the setting is valid for all users and is applied only if Session and User settings cannot be detected.
With the DefaultVIServerMode one should be careful as you may be connected to multiple vCenters on different environments (Test, or Prod) and think that you’re connected only to one server and run something which could affect Production as well. If someone know what he/she is doing or if he/she writes scripts which point exactly to a vCenter by utilizing -Server parameter of each cmdlet, then Multiple value would make more sense as it is easier to work with multiple environments.
This information can be read using Get-PowerCLIConfiguration cmdlet.