Skip to content

Commit a46854f

Browse files
committed
better PS/WMI sample
1 parent af2d4e8 commit a46854f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bobwinrmntlm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ func runExec(address string, port int, https bool, userName string, password str
4343
fmt.Println("Command Test Ok")
4444
}
4545

46-
psCommand := fmt.Sprintf(`$FormatEnumerationLimit=-1; Get-WmiObject -Query "%s" | Out-String -Width 4096`)
46+
wmiQuery := `select * from Win32_ComputerSystem`
47+
psCommand := fmt.Sprintf(`$FormatEnumerationLimit=-1; Get-WmiObject -Query "%s" | Out-String -Width 4096`, wmiQuery)
4748
stdOut, stdErr, exitCode, err = client.RunPSWithContext(context.Background(), psCommand)
4849
fmt.Printf("%d\n%v\n%s\n%s\n", exitCode, err, stdOut, stdErr)
4950
if err != nil || (len(stdOut) == 0 && len(stdErr) > 0) {

0 commit comments

Comments
 (0)