Simplest terms - this powershell command is what I want stored in an AHK variable/array/etc.
Get-WMIObject -Class Win32_Share -ComputerName "HostName" -Credential "HostLogin"
Code: Select all
;NOTE: Need to figure out how to pass -Credentials with the command, as well as to define a remote host name
;http://msdn.microsoft.com/en-us/library/aa394132%28v=vs.85%29.aspx
PropertyList := "Name,Path,Description"
objWMIService := ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . A_ComputerName . "\root\cimv2")
WQLQuery = Select * From Win32_Share
colDiskDrive := objWMIService.ExecQuery(WQLQuery)._NewEnum
While colDiskDrive[objDiskDrive]
Loop, Parse, PropertyList, `,
DiskDriveInfo .= A_index = 1 ? objDiskDrive[A_LoopField] . "`n" : "`t" . A_LoopField . ":`t" . objDiskDrive[A_LoopField] . "`n"
ListVars
MsgBox %DiskDriveInfo%
ExitApp
ESC::ExitApp