We need to be able to do the following:

After sysprep runs on a server, a script needs to run that will
- execute a command at a command prompt (this will add VLANs to our
server's NIC, which we are already able to do, but only for one set of
VLANs. we have mulitple pools of servers that each use different
VLANs), then
- retrieve the numbers from the servers name, no matter the name length
(we have different pools of servers that have different lengths for
their names, but all have 1-3 digits at the end of their name)
- apply the numbers to a script (that will assign IPs to the newly
create VLANs) using the number as the last octet of, then finally
- run an already bat file that will copy all necessary data...

any help would be greatly appreciated...i keep trying different things,
but as i am in no way a vbs master, i keep hitting dead ends..

thanks!!

RE: Can't seem to find a solution for this one... by BaardSchyen

BaardSchyen
Thu Jan 25 14:55:00 CST 2007

Hi.

You can use vbscript regular expression:

'** Objects:
Set oNet = Wscript.CreateObject("Wscript.Network")

'** Find the three last characters in servername (this computer):
strSRV = Right(oNet.ComputerName, 3)

'** Search for a-z:
strA = "[a-z]"

'** Replace with:
strB = ""

'** Replace any letters with nothing:
Set oRegexp = New Regexp
oRegexp.Pattern = strA
oRegexp.Global = TRUE
oRegexp.IgnoreCase = TRUE
strSRV = oRegexp.Replace(strSRV, strB)

'** Leaving only the numbers:
msgbox strSRV

'** Further processing (vlan etc):
'...

--
Regards,
Baard Schøyen


"kirk.jantzer@gmail.com" wrote:

> We need to be able to do the following:
>
> After sysprep runs on a server, a script needs to run that will
> - execute a command at a command prompt (this will add VLANs to our
> server's NIC, which we are already able to do, but only for one set of
> VLANs. we have mulitple pools of servers that each use different
> VLANs), then
> - retrieve the numbers from the servers name, no matter the name length
> (we have different pools of servers that have different lengths for
> their names, but all have 1-3 digits at the end of their name)
> - apply the numbers to a script (that will assign IPs to the newly
> create VLANs) using the number as the last octet of, then finally
> - run an already bat file that will copy all necessary data...
>
> any help would be greatly appreciated...i keep trying different things,
> but as i am in no way a vbs master, i keep hitting dead ends..
>
> thanks!!
>
>