Solved

WMI - VB - Pass variable to DOS Command?  Write Command Info to BAT File?

Posted on 2004-04-23
1
737 Views
Last Modified: 2013-12-03
Hi,

I need to fully automate the process that adds the machine to the domain; however, I am stuck on the last part.  Am I able to pass a variable I declared earlier in the script to the DOS Command?  Example Below:

set objWMIService = GetObject("winmgmts://" & Computer)
set objShell = WScript.CreateObject("WScript.Shell")
  objShell.Run"cmd.exe /C NETDOM ADD /d:Domain **Need to pass Variable Here (Computer Name)*** /ud:mydomain\admin /pd:password", 0, False

I already have the machine name declared previously in the program.  If this isn't possible, I am able to have this WMI script create a batchfile on the file that will write the command as test and put the proper variable in it?  

Thanks!
0
Comment
Question by:jkrech17
1 Comment
 
LVL 8

Accepted Solution

by:
Anthony2000 earned 500 total points
ID: 10924513
Have you tried:

objShell.Run"cmd.exe /C NETDOM ADD /d:Domain " & yourComputerNameVarHere & " /ud:mydomain\admin /pd:password", 0, False

I hope this helps

Anthony
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now