Created
August 16, 2021 14:41
-
-
Save zdi-team/a2eb014d248e4e54a2ab4ba4ae3ac3cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$uri = 'http://127.0.0.1:8000/PowerShell/' | |
$username = 'whatever' # unimportant | |
$password = 'whatever' # unimportant | |
$secure = ConvertTo-SecureString $password -AsPlainText -Force | |
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $secure) | |
$option = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck | |
$params = @{ | |
ConfigurationName = "Microsoft.Exchange" | |
Authentication = "Basic" | |
ConnectionUri = $uri | |
Credential = $creds | |
SessionOption = $option | |
AllowRedirection = $ture | |
} | |
$session = New-PSSession @params | |
Invoke-Command -Session $session -ScriptBlock { | |
# PowerShell commands to execute... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment