[英]powershell's Get-WmiObject -Class Win32_Share returns null paths
im trying to get a list of shares and thier paths from a remote server using powershell, as below (servername obviscated) 我试图使用powershell从远程服务器获取共享和它们的路径的列表,如下所示(排除了服务器名)
Get-WmiObject -Class Win32_Share -ComputerName servername Get-WmiObject-类Win32_Share -ComputerName服务器名
This retuns the list of shares from the remote machine, but the share path attribute is null for every row, unless I add the account im using to the local administrators group on the remote machine in which case it returns the path values. 这会重新调整来自远程计算机的共享列表,但是共享路径属性的每一行都为null,除非我将帐户im using添加到远程计算机上的本地管理员组,在这种情况下,它将返回路径值。
Can anyone help me work out what specific permissions might be required? 谁能帮助我确定可能需要哪些特定权限?
This is what i've tried so far; 到目前为止,这是我尝试过的。 -adding to remote servers 'performance monitor users' group -adding the account to the COM security access permissions & lauch and activation permissions -adding the account to the DCOM Windows Management and Instrumentation Launch and Activation Permissions -添加到远程服务器的“性能监视器用户”组-将帐户添加到COM安全访问权限,启动和激活权限-将帐户添加到DCOM Windows管理和工具启动和激活权限
By running this command with a non admin account, you will get null and it will not return the path for it by design. 通过使用非管理员帐户运行此命令,您将获得null,并且它不会按设计返回该路径。 Looking over the following technet article what describes this class : 查看以下technet文章描述了该类的内容:
Win32_Share class http://msdn.microsoft.com/en-us/library/aa394435(v=vs.85).aspx Win32_Share类http://msdn.microsoft.com/zh-cn/library/aa394435(v=vs.85).aspx
Remarks The Win32_Share class is derived from CIM_LogicalElement. 备注Win32_Share类派生自CIM_LogicalElement。 The Create method in this class is a static method. 此类中的Create方法是静态方法。 The Delete, GetAccessMask and SetShareInfo methods are all instance methods. Delete,GetAccessMask和SetShareInfo方法都是实例方法。 Depending on your security permissions, you may not be able to retrieve all of the properties of this class. 根据您的安全权限,您可能无法检索此类的所有属性。 For example, AllowMaximum, MaximumAllowed, Path, and Type properties may return null. 例如,AllowMaximum,MaximumAllowed,Path和Type属性可能返回null。 Generally speaking, Power Users and Administrators will be able to retrieve all property values. 通常,高级用户和管理员将能够检索所有属性值。
With other words, this is by design as it should . 换句话说,这是设计使然。 As non admin the you should not have everything returned as an admin account. 作为非管理员,您不应该将所有内容作为管理员帐户返回。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.