关于wmi中符号“`”的问题以及虚拟机容量更改


PowerShell交流中心分类: 变量-函数-脚本-条件-循环-参数关于wmi中符号“`”的问题以及虚拟机容量更改
0
Kono asked 6 年 ago

这几天在看PowerSploit的module,其中有一块代码看不懂:

 $ElevatedTrigger = "`"```$Filter=Set-WmiInstance -Class __EventFilter -Namespace ```"root\subscription```" -Arguments @{name='Updater';EventNameSpace='root\CimV2';QueryLanguage=```"WQL```";Query=```"SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'Win32_PerfFormattedData_PerfOS_System' AND TargetInstance.SystemUpTime >= 240 AND TargetInstance.SystemUpTime < 325```"};```$Consumer=Set-WmiInstance -Namespace ```"root\subscription```" -Class 'CommandLineEventConsumer' -Arguments @{ name='Updater';CommandLineTemplate=```"```$(```$Env:SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive```";RunInteractively='false'};Set-WmiInstance -Namespace ```"root\subscription```" -Class __FilterToConsumerBinding -Arguments @{Filter=```$Filter;Consumer=```$Consumer} | Out-Null`""

 

这里面的每个符号`是什么意思呀,我可以弄的懂第一个`是接着写命令(我看书上说然后自己在控制台试了一下),之后的就不懂了 老师指点一下? 还有个小技巧想问下:PowerShell里有没有可以更改虚拟机存储容量的命令 (我可以在GUI下更改但是找不到PowerShell命令除了New-VM,但是我想要的是更改现有的虚拟机容量)

 

Kono replied 6 年 ago

之前理解错了,我已经懂了,这个变量好像就是一个字符串,符号`只是为了显示后面的字符,一个小陷阱,我如果理解的不对还请大牛指点。
但是我还是找不到关于虚拟机的哪个命令