Jump to content

Unattended Change Computer Name


Recommended Posts

Hey Hello,

I'm Not working with RIS From microsoft but with a Other programm Called Unattended.

It almost does the same as RIS but this supports more NIC's and does some other things automatic.

But wat I want to know is How I can Change The Computername Unattended.

What I want is:

It Looks in The AD for existing computernames and makes an new one.

I've heard It's possible whit VBS but I have'nt found a good script yet

so maby someone from here could help.

I hope so

Greetz,

Batcompu

Link to comment
Share on other sites


I made a hypertext application using VBscript that displays a dialog box for the user to enter the computer name, and some usernames and passwords. The basic gist of renaming a computer in VBscript is as follows:

Dim strComputer, objWMIService, colComputers, objComputer, strName
strComputer="."
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers=objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
Err = ObjComputer.Rename(strName)
Next

You can substitue the variable strName with a direct name of "ComputerName". Note that the quotes are necessary if not using a variable. But you can derive strName in any number of ways that you see fit.

Link to comment
Share on other sites

Ok It almost Works But when I make strName variable (without the qoutes) I'm getting the next error:

Row: 6

Character: 1

Code: 8004102F

Error: Wrong Paramater(s)

Source: SWbemObjectEX

Dim strComputer, objWMIService, colComputers, objComputer, strName
strComputer="."
Set objWMIService=GetObject("winmgmts:" &

"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers=objWMIService.ExecQuery("Select * from
Win32_ComputerSystem")
For Each objComputer in colComputers
Err = ObjComputer.Rename ("strName")

Next

And can I ad something to the computername that isn't variable + a variable number.

Because all our Computers are Named "Clone" + the variable Number.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...