SCCM Script - Prompt for local username
I'm looking for a script that prompts for a domain username and adds to the local admin group. I do not have access to Modify Collection Settings as the SCCM was migrated from SMS so I have to use a script. And I'm still fairly new to all this. I've tried to use the only one I could find: Dim objFSO, objFile, objRoot, objShell set env = CreateObject("Microsoft.SMS.TSEnvironment") Set objShell = wscript.CreateObject("WScript.Shell") strUser = env("usernameforadmin") Set objRoot = GetObject("LDAP://rootDSE") strDomain = objRoot.Get("defaultNamingContext") strNETBIOS = Mid(strDomain, InStr(1, strDomain, "=") + 1, (InStr(1, strDomain, ",") - 1) - InStr(1, strDomain, "=")) objshell.run "net localgroup administrators " & strNETBIOS & "\" & strUser & " /add" But that doesn't appear to prompt for anything nor does it add any users to the local admin group. Can anybody provide a better script and some instructions on how to create it & add to the task sequence? Thanks!
April 7th, 2011 1:21pm

Are you wanting to do this during an OS deployment? I think there's an HTA for this. Can also be done using the MDT database. John Marcum | http://myitforum.com/cs2/blogs/jmarcum/|
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2011 2:14pm

Yes I'd like to do it during a deployment. Can you explain or provide some directions/links for those two methods? (HTA & MDT) It looks like there are some options to add MDT steps to the task sequence.
April 7th, 2011 2:52pm

That function is built-in with the UDI frontend for ConfigMr 2007 (part of MDT 2010 Update 1). / JohanRegards / Johan Arwidmark Twitter: @jarwidmark Blog: http://www.deploymentresearch.com FB: www.facebook.com/deploymentresearch
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2011 3:51pm

Hmm I don't think we have that update installed. Is there a script that might just be more to the point that would accomplish this?
April 7th, 2011 8:29pm

You can certainly create your own scripts, but there are existing logic in the free MDT 2010 extension to ConfigMgr 2007, even without the UDI pieces... Once you add MDT to ConfigMgr 2007 you get a full framework with additional functions, one is adding members to local admin groups Anyway, if you want to do this without MDT you can create two vbscripts, one that prompts you for the user name in the preinstall phase (in WinPE), and a second that adds the user to local admin group in the state restore phase. Another way is using group policy to assign members to local groups (maybe not very useful for indivudal accounts, but still) / Johan Regards / Johan Arwidmark Twitter: @jarwidmark Blog: http://www.deploymentresearch.com FB: www.facebook.com/deploymentresearch
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2011 4:11am

sorry to dig up an old thread, but this is exactly what we're trying to accomplish. Johan, can you elaborate on your answer a bit? MDT has been added to sccm, how do we get a variable prompt during a deployment to add a domain user to the local admin group? Thanks TimTim Magnuson | Microsoft Community Contributor Award 2011 | Ok, so I changed my name...you can still call me Tom if you like. It's a...jump...to conclusions...mat. My Blog Site: http://tmagnuson.wordpress.com
July 11th, 2011 3:27pm

Create a script or HTA that prompts for the username, and set the Administrators001 value. MDT will then add that user to the local administrators group. / JohanRegards / Johan Arwidmark Twitter: @jarwidmark Blog: http://www.deploymentresearch.com FB: www.facebook.com/deploymentresearch
Free Windows Admin Tool Kit Click here and download it now
July 12th, 2011 5:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics