Batcompu Posted January 12, 2006 Share Posted January 12, 2006 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 yetso maby someone from here could help.I hope soGreetz,Batcompu Link to comment Share on other sites More sharing options...
RogueSpear Posted January 12, 2006 Share Posted January 12, 2006 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, strNamestrComputer="."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)NextYou 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 More sharing options...
Batcompu Posted January 13, 2006 Author Share Posted January 13, 2006 Ok It almost Works But when I make strName variable (without the qoutes) I'm getting the next error:Row: 6Character: 1Code: 8004102FError: Wrong Paramater(s)Source: SWbemObjectEXDim strComputer, objWMIService, colComputers, objComputer, strNamestrComputer="."Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colComputers=objWMIService.ExecQuery("Select * from Win32_ComputerSystem")For Each objComputer in colComputersErr = 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 More sharing options...
Shamwari Posted January 13, 2006 Share Posted January 13, 2006 I don't know if this tool can help, but I found it very useful:Workstation Name ChangerHope it helps.Shamwari Link to comment Share on other sites More sharing options...
Batcompu Posted January 13, 2006 Author Share Posted January 13, 2006 I don't know if this tool can help, but I found it very useful:Workstation Name ChangerHope it helps.ShamwariIt Looks great.I will test it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now