March 17, 200620 yr 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, 200620 yr by chiners_68
March 17, 200620 yr 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!
March 17, 200620 yr 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
March 17, 200620 yr 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;}
March 20, 200620 yr Author 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..
March 20, 200620 yr 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;}
Create an account or sign in to comment