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

PowerShell: Use EMCOPY to Mirror a Directory

# Purpose: this PowerShell snippet is to demonstrate the use of Emcopy$source="C:\Users\tester\Desktop\Clients"$destination="C:\Users\tester\Desktop\Test"#$switches="/o /secforce /s /de…

PowerShell: Email Users with Expiring Passwords

# PasswordExpirationNotification.ps1 # Description: # This script performs the following tasks # a. Query Active…

Check Whether an Entity Has Access to a Directory or Its Children

Write-Host "This script just be ran in the context of a File Server Administrators member"…