使用powershell测试用户登录
我正在使用powershell上的脚本测试其他地方远程服务器上的用户登录,但我遇到了一个错误。 我使用的代码是使用powershell测试用户登录,powershell,powershell-4.0,Powershell,Powershell 4.0,我正在使用powershell上的脚本测试其他地方远程服务器上的用户登录,但我遇到了一个错误。 我使用的代码是 Get-WmiObject -Class win32_account -ComputerName $ComputerName 我得到的错误是: gwmi : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) At line:21 char:21 + $logon_sessions = @(g
Get-WmiObject -Class win32_account -ComputerName $ComputerName
我得到的错误是:
gwmi : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
At line:21 char:21
+ $logon_sessions = @(gwmi win32_logonsession -ComputerName $computername)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
有人能帮我一下吗。你到底想测试哪些登录?我正在测试,以确保在服务器上进行更新后用户仍然可用