Powershell script For VNC creating VNC Shortcut
$a = Get-WmiObject -query "select * from Win32_NetworkAdapterConfiguration where IPEnabled = $true" |
Select-Object -Expand IPAddress |
Where-Object { ([Net.IPAddress]$_).AddressFamily -eq "InterNetwork" }
# Create a Shortcut with Windows PowerShell
$TargetFile = "c:\support\vncviewer.exe"
$ShortcutFile = "x:\windows\temp\VNC.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
#$c = $targetfile + $a
$shortcut.TargetPath = $TargetFile
$Shortcut.Arguments = "$a /password 1234"
$Shortcut.Save()
No comments:
Post a Comment