LeppeRMessiaH Posted April 8, 2011 Share Posted April 8, 2011 (edited) Now I'm using a .vbs that changes the comp name to a fixed one inside the script. However, I was wondering if it is possible to change the computer's name to one that includes the name of the current user. The best example for this is the OOBE of Windows 7 where it asks for user name then automatically sets the computer name like USERNAME-PC. Can vbs use variables like %USERNAME% or get that value from the registry and add something extra to the final result without asking for any input? Thanks Edited April 8, 2011 by LeppeRMessiaH Link to comment Share on other sites More sharing options...
Tripredacus Posted April 8, 2011 Share Posted April 8, 2011 You can pull the currently logged in account from WMI, in the Win32_ComputerSystem you can get the UserName object. You'll need to do an LTrim on it because it will return COMPUTERNAME\USERNAME as part of the data. Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 8, 2011 Share Posted April 8, 2011 Another way, this would require that a user is log on.Dim Act :Set Act = CreateObject("Wscript.Shell")Dim UNm :UNm = Act.ExpandEnvironmentStrings("%UserName%") Link to comment Share on other sites More sharing options...
LeppeRMessiaH Posted April 8, 2011 Author Share Posted April 8, 2011 Thanks for answering, I think I got it Link to comment Share on other sites More sharing options...
Yens Posted March 15, 2012 Share Posted March 15, 2012 Can you please share your .vbs script Link to comment Share on other sites More sharing options...
LeppeRMessiaH Posted March 15, 2012 Author Share Posted March 15, 2012 Therecompname.zip 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