We help IT Professionals succeed at work.

VBScript - help making it a bit smaller

796 Views
Last Modified: 2010-05-18
I have a cumbersome VBScript I'd like some help shrinking down. Can you help me compact this a bit?

Thanks! JohnD

'Create Local BizTalk Admin Account
strComputer = "."
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", "bizadmin")
objUser.SetPassword "b1zAdm1n"
objUser.SetInfo

Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
strUser = "bizadmin"
Set objUser = GetObject("WinNT://" & strComputer & "/" & _
    strComputer & "/" & strUser & ",User")
 
objUserFlags = objUser.Get("UserFlags")
objPasswordExpirationFlag = objUserFlags OR ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", objPasswordExpirationFlag
objUser.SetInfo

'Add BizTalk Administrator (bizadmin) to Local Administrators Group
strComputer = "."
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
objGroup.Add(objUser.ADsPath)

'Create Service Groups for BizTalk & Add BizTalk Administrator to each
strComputer = "."
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("group", "BAS Enabled Hosts")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BAS Enabled Hosts,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk Application Users")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk Application Users,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk BAS Administrators")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk BAS Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk BAS Managers")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk BAS Managers,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk BAS Users")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk BAS Users,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk BAS Web Services Group")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk BAS Web Services Group,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk Isolated Host Users")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk Isolated Host Users,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk Server Administrators")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk Server Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "BizTalk Server Operators")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/BizTalk Server Operators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "Debugger Users")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/Debugger Users,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "EDI Subsystem Users")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/EDI Subsystem Users,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "SSO Administrators")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/SSO Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Set objUser = colAccounts.Create("group", "SSO Affiliate Administrators")
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/SSO Affiliate Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/bizadmin,user")
Comment
Watch Question

Ciprian LozonschiOps Team Office 365/Messaging
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
lciprianionut and RobSampson, thank you so much for your help! I hadn't thought of using the net command and will probably do so in the future. However, I am appreciate of the fine example of an array, Rob. This help immensely!
Thanks again,
JohnD
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
No problem JohnD.  Thanks for the points.

Regards,

Rob.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.