Created
May 12, 2019 13:10
-
-
Save krisdb2009/1b31d59725105b9705c172a93e9a9e99 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
$computer = Read-Host -Prompt "Enter PC Name" | |
Write-Host "Pinging $computer..." | |
if (Test-Connection -Computername $computer -BufferSize 16 -Count 1 -Quiet) { | |
Write-Host "Starting WinRM on $computer..." | |
Start-Process -WindowStyle Hidden -FilePath "wmic.exe" -ArgumentList "/node:`"$computer`" process call create `"cmd.exe /c winrm quickconfig -quiet -force`"" -Wait | |
Write-Host "Connecting to $computer..." | |
Enter-PSSession -ComputerName $computer | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment