0
0
PowerShellscripting~20 mins

SSH-based remoting (PowerShell 7+) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SSH Remoting Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this PowerShell SSH remoting command?
You run this command in PowerShell 7+ to start an interactive session on a remote machine named 'Server01' using SSH remoting:

Enter-PSSession -HostName Server01 -UserName AdminUser

What will be the immediate output if the connection is successful?
PowerShell
Enter-PSSession -HostName Server01 -UserName AdminUser
AA prompt changes to indicate the remote session, e.g., [Server01]: PS>
BThe command outputs a list of running processes on Server01
CAn error message: 'The term Enter-PSSession is not recognized'
DThe local PowerShell session closes immediately
Attempts:
2 left
💡 Hint
Think about what Enter-PSSession does when connecting successfully.
💻 Command Output
intermediate
2:00remaining
What error occurs when SSH remoting fails due to wrong credentials?
You try to connect to a remote machine using:

Enter-PSSession -HostName Server02 -UserName WrongUser

The password is incorrect. What error message will PowerShell most likely show?
PowerShell
Enter-PSSession -HostName Server02 -UserName WrongUser
ASSH authentication failed: Permission denied (publickey,password).
BThe remote session starts successfully without error.
CError: The term 'Enter-PSSession' is not recognized.
DTimeout expired while waiting for remote command to complete.
Attempts:
2 left
💡 Hint
Think about what happens when SSH credentials are wrong.
📝 Syntax
advanced
2:00remaining
Which command correctly runs a script block on a remote machine using SSH remoting?
You want to run the script block { Get-Process | Select-Object -First 3 } on a remote machine 'Server03' using SSH remoting. Which command is syntactically correct?
AInvoke-SSHCommand -HostName Server03 -ScriptBlock { Get-Process | Select-Object -First 3 }
BInvoke-Command -ComputerName Server03 -ScriptBlock { Get-Process | Select-Object -First 3 }
CInvoke-Command -HostName Server03 -Command { Get-Process | Select-Object -First 3 }
DInvoke-Command -HostName Server03 -ScriptBlock { Get-Process | Select-Object -First 3 }
Attempts:
2 left
💡 Hint
Use the correct parameter for SSH remoting in PowerShell 7+.
🔧 Debug
advanced
2:00remaining
Why does this SSH remoting command fail with 'The term 'Enter-PSSession' is not recognized'?
You run this command in PowerShell 5.1 on Windows:

Enter-PSSession -HostName Server04 -UserName AdminUser

and get the error:

The term 'Enter-PSSession' is not recognized as the name of a cmdlet...

What is the most likely cause?
PowerShell
Enter-PSSession -HostName Server04 -UserName AdminUser
AThe user 'AdminUser' does not have permission on the remote server.
BThe remote server 'Server04' is offline.
CPowerShell 5.1 does not support SSH-based remoting with -HostName parameter.
DThe SSH service is not installed on the local machine.
Attempts:
2 left
💡 Hint
Check PowerShell version compatibility for SSH remoting.
🚀 Application
expert
3:00remaining
How to run a remote command on multiple machines using SSH remoting in PowerShell 7+?
You have a list of remote servers stored in $servers = @('ServerA', 'ServerB', 'ServerC'). You want to run Get-Service on all of them using SSH remoting and collect the results locally. Which script correctly does this?
AInvoke-Command -HostName $servers -ScriptBlock { Get-Service }
B$servers | ForEach-Object { Invoke-Command -HostName $_ -ScriptBlock { Get-Service } }
C$servers | ForEach-Object { Enter-PSSession -HostName $_ -ScriptBlock { Get-Service } }
DInvoke-SSHCommand -ComputerName $servers -Command 'Get-Service'
Attempts:
2 left
💡 Hint
Think about how to run commands on multiple hosts sequentially and collect output.