|
24 | 24 | POWERSHELL_COMMAND_CASES = [
|
25 | 25 | pytest.param(
|
26 | 26 | "Write-Output 'Hello, world, it`s me!'",
|
27 |
| - "powershell -Command 'Write-Output ''Hello, world, it`s me!'''", |
| 27 | + "powershell -Command \"Write-Output ''Hello, world, it`s me!''\"", |
28 | 28 | id='Hello World message',
|
29 | 29 | ),
|
30 | 30 | pytest.param(
|
31 | 31 | r"New-Item -Path 'C:\Users\User\example.txt' -ItemType 'File'",
|
32 |
| - "powershell -Command 'New-Item -Path ''C:\\Users\\User\\example.txt'' -ItemType ''File'''", |
| 32 | + "powershell -Command \"New-Item -Path ''C:\\Users\\User\\example.txt'' -ItemType ''File''\"", |
33 | 33 | id='New file in path with backslashes',
|
34 | 34 | ),
|
35 | 35 | pytest.param(
|
36 | 36 | "$message = 'This is a test with special chars: `&^%$#@!'; Write-Output $message",
|
37 |
| - "powershell -Command '$message = ''This is a test with special chars: `&^%$#@!''; Write-Output $message'", |
| 37 | + "powershell -Command \"$message = ''This is a test with special chars: `&^%$#@!''; Write-Output $message\"", |
38 | 38 | id='Special characters message',
|
39 | 39 | ),
|
40 | 40 | pytest.param(
|
|
46 | 46 | "$sessionId = $sessionInfo[2]; if ($users -contains $username) { logoff $sessionId } } }"
|
47 | 47 | ),
|
48 | 48 | (
|
49 |
| - "powershell -Command '$users = @(JohnDoe) -split '';''; query user | Select-Object -Skip 1 | " |
| 49 | + "powershell -Command \"$users = @(JohnDoe) -split '';''; query user | Select-Object -Skip 1 | " |
50 | 50 | "ForEach-Object { $sessionInfo = $_ -split ''\\s+'' | "
|
51 | 51 | "Where-Object { $_ -ne '''' -and $_ -notlike ''Disc'' }; "
|
52 | 52 | "if ($sessionInfo.Length -ge 6) { $username = $sessionInfo[0].TrimStart(''>''); "
|
53 |
| - "$sessionId = $sessionInfo[2]; if ($users -contains $username) { logoff $sessionId } } }'" |
| 53 | + "$sessionId = $sessionInfo[2]; if ($users -contains $username) { logoff $sessionId } } }\"" |
54 | 54 | ),
|
55 | 55 | id='End RDP session for users',
|
56 | 56 | ),
|
|
0 commit comments