I opened a case and they referenced this KB as a known issue under investigation:
It does not list this as a work-around - but lines up. I would say there's risk of leaving a number of active sessions if leveraging the adv option.
Original Message:
Sent: Sep 09, 2024 11:46 AM
From: LucD
Subject: PowerCLI sessions disconnecting during a script (Seems to only happen after vCenter 8 upgrade)
Good for you.
It must be an undocumented feature.
I can't even read it back with a Get-AdvancedSetting cmdlet, that just returns nothing.
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Sep 09, 2024 11:17 AM
From: Josh Atwell
Subject: PowerCLI sessions disconnecting during a script (Seems to only happen after vCenter 8 upgrade)
FYI - I set this in a couple environments as a vCenter Advanced Option (=true) and it has cleared up my issue.
config.vpxd.authorize.sessionCanOutliveToken
It definitely makes a difference, it has gotten rid of missing data on all reports for vCenters that it has been applied to.
LucD - you were not able to apply it? Any insight?
I still need to open a case to validate/figure out if there is any downside to this setting.
Original Message:
Sent: Aug 29, 2024 11:40 AM
From: amarvarudegt
Subject: PowerCLI sessions disconnecting during a script (Seems to only happen after vCenter 8 upgrade)
Add this advanced settings to the vCenter - config
.
vpxd
.
authorize
.
sessionCanOutliveToken=true
Original Message:
Sent: Aug 28, 2024 12:51 AM
From: LucD
Subject: PowerCLI sessions disconnecting during a script (Seems to only happen after vCenter 8 upgrade)
Not that I know of.
I suggest opening an SR.
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Aug 27, 2024 09:02 AM
From: Josh Atwell
Subject: PowerCLI sessions disconnecting during a script (Seems to only happen after vCenter 8 upgrade)
We have a larger environment and have a ton of audit and health-check scripts.
Ever since we upgraded our larger vCenter servers to vSphere 8, we're seeing a number of these scripts disconnect and not fully capture info from all hosts/vms.
Is there a new session timeout or max connections/sessions or throttle setting that was introduced in vSphere 8 for PowerCLI/API?
An example is a network audit script that checks for CDP info. There's a loop that calls the sample code below, if a vCenter has > 150 hosts it seems to just disconnect the session after ~ 150 hosts. Wrapping the two specific calls below in a try/catch w/ a reconnect works, but, eek.
foreach ($vmhost in $vmhosts){ $networkSystem = Get-view $vmhost.ConfigManager.NetworkSystem foreach($pnic in $networkSystem.NetworkConfig.Pnic){ $pnicInfo = $networkSystem.QueryNetworkHint($pnic.Device) <reporting stuff> }}This works:try{$networkSystem = Get-view $vmhost.ConfigManager.NetworkSystem} catch{if(!$global:DefaultVIServer[0].IsConnected){connect-viserver $global:DefaultVIServer[0]}; $networkSystem = Get-view $vmhost.ConfigManager.NetworkSystem} try{$pnicInfo = $networkSystem.QueryNetworkHint($pnic.Device)} catch{if(!$global:DefaultVIServer[0].IsConnected){connect-viserver $global:DefaultVIServer[0]};$pnicInfo = $networkSystem.QueryNetworkHint($pnic.Device)}
Seems to be easily reproduceable
We're also seeing it on scripts that collect stats during a specific time period for many VMs.
It doesn't seem time based, more load/call based. We use some VM migrations scripts that run for hours at a time w/o ever disconnecting.
Any idea where to start digging?
No issues w/ vSphere 7 vCenters.