hi,
Has anyone got a script that deletes all local user accounts, except ones I specify such as the administrator account and service accounts and also enables and sets a password for the local admin account.
Its for windows7.
Thanks
hi,
Has anyone got a script that deletes all local user accounts, except ones I specify such as the administrator account and service accounts and also enables and sets a password for the local admin account.
Its for windows7.
Thanks
Have a see if this will do what you want How to Add domain accounts to Local Administrators Group using GPO - Richard's myITforum Blog
Richard

Are you using Server 2008 R2? You can do this in group policy preferences
I have this batch file:
or a nice VB script:Code:@echo off c: cd\ cd "c:\Documents and Settings\" dir *.* /b /o:d > \dirs.txt for /f "tokens=*" %%a in (\dirs.txt) do call :DelFiles "%%a" del \dirs.txt exit /b :DelFiles %1 set Flag=0 if %1=="All Users" set Flag=1 if %1=="Administrator" set Flag=1 if "%Flag%"=="0" ( cd %1 attrib *.* -r /s cd.. rem change rd %1 /s /q rem for no confirmation rd %1 /s /q )
Code:On Error Resume Next Dim obtainfolder Dim Pathfinder Dim strPath Set fso = CreateObject("Scripting.FileSystemObject") strPath = "C:\Documents and Settings\" userexcludelist = "Administrator,All Users,Default User,localservice,networkservice," Set f = fso.GetFolder(strPath) ' Loop through all subfolders For Each fldrItem in f.SubFolders fldrName = fldrItem.name If Right(strPath,1) <> "\" Then Pathfinder = strPath & "\" & fldrName Else Pathfinder = strPath & fldrName End If If InStr(1, ".00", fldrName, 1) Then set obtainfolder = fso.GetFolder(Pathfinder) obtainfolder.Delete true Else End If Next ' Clean up objects Set fso = Nothing Set fc = Nothing
check my blog here and look for Shonks script.
bio..
There are currently 1 users browsing this thread. (0 members and 1 guests)