Closed pcamelio closed 1 year ago
OS : Windows 2019 Get-WmiObject with ComputerName and -AsJob is not working properly, at least for me.
QuickandDirt solution to overcome the problem Line 259
$j = Get-WmiObject -ComputerName $RServerName ` -Namespace $DFSNamespace ` -Query $WMIQuery ` -ErrorAction Ignore -AsJob [void](Wait-Job $j -Timeout $RequestTimeout) If ($j.State -eq "Completed") { Try { #и пытаемся извлечь с этого партнера вектор версии $VersionVector = (Receive-Job $j).GetVersionVector().VersionVector #На отправляющем партнере (т.е. на локальном сервере) определяем размер бэклога для найденного вектора (Get-WmiObject ` -Namespace $DFSNamespace ` -Query $WMIQuery).GetOutboundBacklogFileCount($VersionVector).BacklogFileCount } Catch { If ($VersionVector) { "Couldn't retrieve backlog info for vector '$VersionVector'" } Else { "Version vector not found" } } } Else { "Couldn't retrieve info from partner '$RServerName'" }
by
try{ $j = Get-WmiObject -ComputerName $RServerName ` -Namespace $DFSNamespace ` -Query $WMIQuery ` -ErrorAction Ignore Try { #и пытаемся извлечь с этого партнера вектор версии $VersionVector = $j.GetVersionVector().VersionVector #На отправляющем партнере (т.е. на локальном сервере) определяем размер бэклога для найденного вектора (Get-WmiObject ` -Namespace $DFSNamespace ` -Query $WMIQuery).GetOutboundBacklogFileCount($VersionVector).BacklogFileCount } Catch { If ($VersionVector) { "Couldn't retrieve backlog info for vector '$VersionVector'" } Else { "Version vector not found" } } } catch { "Couldn't retrieve info from partner '$RServerName'" }
It seems, you have firewall issue. See here for more information.
OS : Windows 2019 Get-WmiObject with ComputerName and -AsJob is not working properly, at least for me.
QuickandDirt solution to overcome the problem Line 259
by