Summery
PS Session access allows you to enter an interactive session with the target computer. It generally uses WinRM to work so it’s ports have to be enabled.
Usage
-
First create a PSCredential object.
$SecPassword = ConvertTo-SecureString 'Jenni_Luvs_Magic23' -AsPlainText -Force- Convert the plaintext password into a PowerShellSecureString.
$Cred = New-Object System.Management.Automation.PSCredential('frizz.htb\f.frizzle', $SecPassword)- Create a credential object containing the username and password. -
Then use the New-PSSession command with the credential we just created.
$session = New-PSSession -ComputerName FRIZZDC.FRIZZ.HTB -Credential $Cred- Create a remote PowerShell session to the target using those credentials. -
You can then run a command on the system using the Invoke-Command cmdlet and the session you just created.
Invoke-Command -Session $session -ScriptBlock {Start-Process cmd}
Or enter the remote session interactively.
Enter-PSSession $session