
WMI और PowerShell (रिमोटिंग नहीं) का उपयोग करके दूरस्थ रूप से Windows कमांड निष्पादित करें और आउटपुट कैप्चर करें।
Windows के लिए रिमोट एक्ज़ीक्यूशन टूल्स जो केवल WMI और PowerShell पर निर्भर करते हैं।
PowerShell Remoting, WinRM या PsExec पर निर्भर किए बिना रिमोट रूप से कंसोल कमांड चलाएँ और stdout/stderr स्ट्रीम्स को कैप्चर करें।
इस तकनीक के बारे में ब्लॉग पोस्ट और वीडियो।
नीचे दिया गया उदाहरण आपको दिखाता है कि WmiExec कैसे पाइपलाइन से कमांड स्ट्रिंग को मान के रूप में स्वीकार कर सकता है।
PS C:\ "Get-ChildItem C:\" | .\WmiExec.ps1 -ComputerName "server1"
Running the following command on: server1...
Get-ChildItem C:\
PID: 5580 - Waiting for remote command to finish...
PID: 5580 - Waiting for remote command to finish...
Result...
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 28.06.2018 15:16 PerfLogs
d-r--- 09.09.2019 15:19 Program Files
d-r--- 07.10.2019 08:36 Program Files (x86)
d-r--- 10.10.2019 10:51 Users
d----- 10.10.2019 16:00 Windows
नीचे दिया गया उदाहरण आपको लौटाया गया ऑब्जेक्ट प्रकार दिखाता है।
PS C:\ $result = .\WmiExec.ps1 -ComputerName "server1" -Command "Get-ChildItem C:\"
Running the following command on: server1...
Get-ChildItem C:\
PID: 5580 - Waiting for remote command to finish...
PID: 5580 - Waiting for remote command to finish...
Result...
PS C:\ $result.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object
Twitter https://twitter.com/OneScripter
System Frontier का उपयोग करके अपनी PowerShell स्क्रिप्ट्स के लिए RBAC का लाभ उठाने वाले वेब GUI बनाने जैसे और भी शानदार काम करें। https://systemfrontier.com/powershell