chiners_68 Posted March 17, 2006 Share Posted March 17, 2006 (edited) Right, I need to add a domain security group to the local admin group on machines & i have been told we cannot do it through AD as it will knock out any other users that have been manually put into the odd machines local admin group. How can I automate the process of adding a domain security group to the local admin group on install?Also, from the runonce i want the defragmenter "mmc dfrg.msc" to open & run a defragmentation. how can i automate this with what switches to set it running.? I know this can run behind the scenes but i need this to run visually.all help is greatly apreciated.. Edited March 17, 2006 by chiners_68 Link to comment Share on other sites More sharing options...
exrcizn Posted March 17, 2006 Share Posted March 17, 2006 I need to add a domain security group to the local admin group on machines & i have been told we cannot do it through AD as it will knock out any other users that have been manually put into the odd machines local admin group. How can I automate the process of adding a domain security group to the local admin group on installHere's how I do it:I have a file called Admins.cmd that contains the following code:net localgroup "Administrators" /ADD "MFC\TN_DTS_WrkAdm"It's saved in the $1\Installs folder on the CD. This is called by the following statement in RunOnce:REG ADD %KEY%\075 /VE /D "Adding Administrators" /fREG ADD %KEY%\075 /V 1 /D "%systemdrive%\install\admins.cmd" /fHope this helps! Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 17, 2006 Share Posted March 17, 2006 Here is a defrag script that runs hiddenConst Hidden = 0,Normal = 1,Min = 2 Const HD = 2 Dim Act, Fso, Drv Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") Set Drv = Fso.Drives For Each objDrv in Drv If objDrv.DriveType = HD Then Act.Run("Defrag.exe " & objDrv & "\ -F"),Hidden,True End if Next Link to comment Share on other sites More sharing options...
exrcizn Posted March 17, 2006 Share Posted March 17, 2006 gunsmokingman you weren't kidding when you said you know how to script! Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 17, 2006 Share Posted March 17, 2006 Thanks, here is one in Js Script this has a pop up that will tell you what drive it defraggingSave As Defrag.jsvar Fso = new ActiveXObject("Scripting.FileSystemObject"); var Act = new ActiveXObject("Wscript.Shell"); var Drv, strDrv, s, Defrag, V; V = "\\" Disk() function Disk() {for ( var objEnum = new Enumerator(Fso.drives);!objEnum.atEnd();objEnum.moveNext()) {Drv = objEnum.item() if (Drv.IsReady) {if (Drv.DriveType == "2") Defrag = Act.Popup ("Preparing To Defrag This Drive, " + Drv.Path + V+'\n'+ "Volume Name : " +Drv.VolumeName ,5,"Temp Stop", 0 + 32); Act.Run("Defrag.exe " +Drv.Path+V+ " -F",0,true); }} return;} Link to comment Share on other sites More sharing options...
chiners_68 Posted March 17, 2006 Author Share Posted March 17, 2006 Thanks Guys... Link to comment Share on other sites More sharing options...
chiners_68 Posted March 20, 2006 Author Share Posted March 20, 2006 Right, Im runnig this script for defragmenting.var Fso = new ActiveXObject("Scripting.FileSystemObject"); var Act = new ActiveXObject("Wscript.Shell"); var Drv, strDrv, s, Defrag, V; V = "\\" Disk() function Disk() {for ( var objEnum = new Enumerator(Fso.drives);!objEnum.atEnd();objEnum.moveNext()) {Drv = objEnum.item() if (Drv.IsReady) {if (Drv.DriveType == "2") Defrag = Act.Popup ("Preparing To Defrag This Drive, " + Drv.Path + V+'\n'+ "Volume Name : " +Drv.VolumeName ,5,"Temp Stop", 0 + 32); Act.Run("Defrag.exe " +Drv.Path+V+ " -F",0,true); }} return;}but it runs silently without a progress bar or anything.. Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 20, 2006 Share Posted March 20, 2006 This uses the cmd interface to defrag so there is no progress bar I have set it so it sits min on the task bar.Save As Defrag_Min.jsvar Fso = new ActiveXObject("Scripting.FileSystemObject"); var Act = new ActiveXObject("Wscript.Shell"); var Drv, strDrv, s, Defrag, V; V = "\\" Disk() function Disk() {for ( var objEnum = new Enumerator(Fso.drives);!objEnum.atEnd();objEnum.moveNext()) {Drv = objEnum.item() if (Drv.IsReady) {if (Drv.DriveType == "2") Defrag = Act.Popup ("Preparing To Defrag This Drive, " + Drv.Path + V+'\n'+ "Volume Name : " +Drv.VolumeName ,5,"Temp Stop", 0 + 32); Act.Run("Defrag.exe " +Drv.Path+V+ " -F",2,true); }} return;}Yhis makes it the max sizeSave As Defrag_Max.jsvar Fso = new ActiveXObject("Scripting.FileSystemObject"); var Act = new ActiveXObject("Wscript.Shell"); var Drv, strDrv, s, Defrag, V; V = "\\" Disk() function Disk() {for ( var objEnum = new Enumerator(Fso.drives);!objEnum.atEnd();objEnum.moveNext()) {Drv = objEnum.item() if (Drv.IsReady) {if (Drv.DriveType == "2") Defrag = Act.Popup ("Preparing To Defrag This Drive, " + Drv.Path + V+'\n'+ "Volume Name : " +Drv.VolumeName ,5,"Temp Stop", 0 + 32); Act.Run("Defrag.exe " +Drv.Path+V+ " -F",1,true); }} return;} 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