Skip to content

Instantly share code, notes, and snippets.

@unakatsuo
Last active December 21, 2015 22:09
Show Gist options
  • Select an option

  • Save unakatsuo/6373645 to your computer and use it in GitHub Desktop.

Select an option

Save unakatsuo/6373645 to your computer and use it in GitHub Desktop.
VBScripted vmnetcfg UI for VMWare Player 5.
Option Explicit
Dim objWMI, objShell, osInfo, os
' http://hitaki.net/diary/20090522.html
' Prompt UAC elevated privilege dialog.
do while WScript.Arguments.Count = 0 and WScript.Version >= 5.7
Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set osInfo = objWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each os in osInfo
If left(os.Version, 3) < 6.0 Then exit do
Next
Set objShell=CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " uac","","runas",1
WScript.Quit
loop
Dim objWShell
Set objWShell = CreateObject("WScript.Shell")
objWShell.CurrentDirectory = objWShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") & "\VMware\VMware Player"
objWShell.Run "rundll32.exe vmnetui.dll,VMNetUI_ShowStandalone", 1, True
Set objWShell = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment