Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 228309

Re: VMWare Player 5 Silent Install

$
0
0

The attached file "DoForEachUser.vbs.zip" file contains a sample script of how you could add this to your batch .cmd script to implement something for each Local User.  I coded it to skip the "Administrator" and "Guest" accounts for simplicity since I assume with multiple Users on a given system the "Administrator" and "Guest" accounts are probably not being used with VMware Player and in cases where Administrator might not exist like Home versions.  Otherwise additional coding would need to be done to test whether the Administrator account exists and if so is also enabled.

 

I tested this on Windows 7 and Line 14 (shown below) opens Calculator and that was to test that it would open the number of occurrences for the number of accounts and it did.

 

So in your install batch .cmd script you'd call DoForEachUser.vbs and change "calc.exe" to a separate .cmd script that copies/creates the preferences.ini file.

 

Example: cscript DoForEachUser.vbs

 

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set colAccounts = GetObject("WinNT://" & strComputer & "")
colAccounts.Filter = Array("user")
Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")
For Each objUser In colAccounts    Select Case objUser.Name        Case "Administrator"                ' Do Nothing        Case "Guest"                ' Do Nothing        Case Else                objShell.Run  "calc.exe"    End Select
Next

 

The entire script to do everything could easily be written in VB Script however I don't have the time to write it for you and since parsing the User Accounts using basic command line syntax in a .bat or .cmd batch script is more difficult calling a .vbs script from your .cmd script is an easy alternative.

 

Note:  This does not touch the "Default Users" Account so you'd need to seed it with additional lines in the install batch script.  On Windows XP is "Default User" and on Windows 7 it's "Default", etc.

 

Message was edited by: WoodyZ - Modified Code as Dim objShell and Set objShell... should be outside the For Loop.  Uploaded new DoForEachUser.vbs.zip file as well.


Viewing all articles
Browse latest Browse all 228309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>