Posted On July 10, 2019

PowerShell: Install TightVNC on Windows via CLI

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Install TightVNC on Windows via CLI
Install VNC Server on the Remote Windows:
# Access Remote Server via WinRM
$SHERVERNAME = "SHERVER007"
$winRMHttp=5985
$winRMHttps=5986

# Check to ensure that port 5986 is operational
Test-NetConnection $SHERVERNAME -port $winRMHttp
Test-NetConnection $SHERVERNAME -port $winRMHttps

# Connect to remote server's WinRM instance
Enter-PSSession -ComputerName $SHERVERNAME -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) #optional: -Credential (Get-Credential)
# Install Chocolatey if it's not already available
if (!(Get-Command choco.exe -ErrorAction SilentlyContinue)) {
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))}
# Install TightVNC without Password Authentication (defer to Console AD Auths)
choco install tightvnc -y --installArguments 'SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=0'
Install VNC Viewer on the client:
# Install only VNC Viewer
choco install tightvnc -ia "ADDLOCAL=Viewer"

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

A Broken PS-Session Issue

Symptoms: PS C:\Windows\system32> get-pssession Id Name ComputerName ComputerType State ConfigurationName Availability -- ---- ------------ ------------…

PowerShell: Discover Domain Controllers and Classify Each As VM or Physical

Current Version $dcObjects=Get-ADDomainController -Filter * | select Name,OperationMasterRolesforeach ($dc in $dcObjects){ $dcName=$dc.Name $dcRole=$dc.OperationMasterRoles try{ $machineModel=(Get-WmiObject…

PowerShell: Automated Login Validation Using Internet Explorer

Update April 395 A.D.: IE variances make it difficult to perform standardized automation; hence, another…