Skip to content

Commit 6734f1b

Browse files
Qwinsta improvements (#30)
Use where.exe instead of where to avoid confusion with PS. Resolve Qwinsta using recursive search in Winroot to work around limitations in 32-bit sessions. (DIS-1672)
1 parent 310eb5e commit 6734f1b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

acquire/acquire.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io
44
import itertools
55
import logging
6+
import os
67
import shutil
78
import subprocess
89
import sys
@@ -408,7 +409,13 @@ class WinRDPSessions(Module):
408409

409410
@classmethod
410411
def get_spec_additions(cls, target):
411-
qwinsta = subprocess.run(["where", "qwinsta.exe"], capture_output=True, text=True).stdout.split("\n")[0]
412+
# where.exe instead of where, just in case the client runs in PS instead of CMD
413+
# by default where hides qwinsta on 32-bit systems because qwinsta is only 64-bit, but with recursive /R search
414+
# we can still manage to find it and by passing the exact path Windows will launch a 64-bit process
415+
# on systems capable of doing that.
416+
qwinsta = subprocess.run(
417+
["where.exe", "/R", os.environ["WINDIR"], "qwinsta.exe"], capture_output=True, text=True
418+
).stdout.split("\n")[0]
412419
return [
413420
("command", ([qwinsta, "/VM"], "win-rdp-sessions")),
414421
]

0 commit comments

Comments
 (0)