1

I am brand new to VB scripting. Work is making me explore this new avenue. I have always tried to avoid scripting whether it was VB or cmd (windows) because I am a strong believer of Group Policy and not everybody knows the ins and outs of scripting.

To my question or my end result function:

I understand there are many parts of a script I must assemble to do what I want it to do. What I am trying to accomplish is this; We have a windows 2008 domain. our environment is windows XP SP3 and windows 7. There are a bank of PCs that I must turn on Autologin with different user accounts. The bank of PCs have a specific computer name and a specific user account associated with it. For example, computer name BC-R312-10056 is associated to user account domain\10056 meaning the least 5 characters of the computer name is the allowed user account to log in to the PC and also the password is the same as the username. My task is to run a VB script to first grab the computer name, then strip all characters to only the last 5 characters, then plug that value in to the autologin script in the "username" and "password" (create variables) and presto, slap that into runonce and all computers that this script will run will have autologin enabled with the user name and password uniquely set to last 5 characters of computer name. I hope this makes sense since I have been struggling with this for a few weeks.I have found snippets and already made scripts and trying to modify and combine them to make them work for me but I am just have a hard time figuring out how to strip the characters and pass them into a variable to have them called up in the auto log in script.

I am looking for just guidance since this is my chance to learn this VB lingo and get smart.

4

1 回答 1

0

要获取计算机名称的最后 5 个字符,请使用

strUserName = right(strComputerName, 5)

你可以得到计算机名称

Set objNetwork = CreateObject("Wscript.Network")
strComputerName = objNetwork.ComputerName
于 2013-05-31T14:02:06.893 回答