spo*_*son 33 powershell wmi remote-registry
我正在编写一个脚本来开始使用PowerShell.我正在尝试转换一个工作的VBScript脚本,该脚本枚举远程Windows计算机上的映射网络驱动器.
其中一项任务是使用远程WMI来读取注册表并找到explorer.exe的进程所有者,以确定谁登录.这个指南似乎很容易.
但是,我需要调用的WMI方法是来自Win32_Process的GetOwner(),它需要两个输出参数来存储其返回值.
如何调用带输出参数的方法?当我尝试给它两个字符串时,我得到错误:Cannot find an overload for "GetOwner" and the argument count: "2"..MSDN页面说有两个参数,所以我不确定我做错了什么.
Jar*_*Par 42
使用[ref]修饰符
SomeMethod( [ref] $a );
Run Code Online (Sandbox Code Playgroud)
值得注意的博客文章
Sha*_*evy 10
$explorer = gwmi Win32_Process -computerName computerName -filter "Name='explorer.exe' and SessionID=0"
$explorer.GetOwner() | select user,domain
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24796 次 |
| 最近记录: |