问题描述
我怎样才能让这个显示谁在使用我们 NETAPP 上的共享。
$computer = "gozer"
$namespace = "root\CIMV2" # note to self find out if this is correct
$userSessions = Get-WmiObject -class Win32_ServerConnection -computername $computer -namespace $namespace
if($userSessions -ne $null)
{
Write-Host "The following users are connected to your PC: "
foreach ($userSession in $userSessions)
{
$userDetails = [string]::Format("User {0} from machine {1} on share: {2}",$userSession.UserName,$userSession.ComputerName,$userSession.ShareName)
Write-Host $userDetails
}
Read-Host
}
exit
当我运行这个指向 NETAPP SVM 时收到的错误是:
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At C:\test\whos-using-the-share.ps1:3 char:17
+ $userSessions = Get-WmiObject -class Win32_ServerConnection -computername $compu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject],COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)