githubEdit

Powershell Credentials Object Creation

Commands:

1)

$SecPassword = ConvertTo-SecureString 'PASSWORD' -AsPlainText -Force

2)

$Cred = New-Object System.Management.Automation.PSCredential('DOMAIN.LOCAL\USERNAME', $SecPassword)

3)

Invoke-Command -Computer COMPUTER_NAME -Credential $Cred -ScriptBlock { COMMAND_TO_EXECUTE } 

Use case:

When we have valid credentials on a domain joined user, but he has no access to RDP or/and WinRM (Remote Desktop Users and Remote Management Users)

Alternatively, we can authenticate with a PSSession

4) CREDSSP for example

$session = New-PSSession -CompuerName COMPUTER_NAME -Credential $Cred -Authentication AUTHENTICATION_METHOD 

5)

Enter-PSSession $session

Alternate use case: The credentials found are encrypted in some way. To recover the credentials, we do the following commands:

Last updated