Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: Run Maintenance on a PC through Script.

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,37156
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: Run Maintenance on a PC through Script.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 RE: Run Maintenance on a PC through Script. - 9/6/2006 1:41:39 AM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
this may help. when I get time I'll try help further


      

//EDIT: added code tags

< Message edited by Snipah -- 10/9/2006 11:53:00 PM >

(in reply to morpheus83uk)
 
 
Post #: 21
 
 RE: Run Maintenance on a PC through Script. - 9/6/2006 3:22:08 AM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Oh My word!!!!!

I have no idea what any of that means....

Ok from the top...

Disk Cleanup...

I  have run the below command to setup Disk Cleanup automatically....

cleanmgr /d c: /sageset:100

I have set the options and ticked all the boxes....

Now I believe the values are stored here:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \VolumeCaches

Which is fine... So if I use the cleanmgr /sagerun:100 could I import the settings from the registry onto another PC and then run the above command? (Through a Script)

Ok the defrag hard drive....

Kind of a little bit lost here... I am presuming that the whole thing defrags the C drive and forces it to do it now without analysis but checks to see if its a Saturday?? If this is true thats great it would indeed work for me but I need it to defrag all the hard disks on the drive...  is there just a slight modification needed or am I completly wrong about the code???

Ok deleting the users accounts...

Would that remove the Admin2 account there? and remove the registry entries just like it would if you were to remove it from the system icon within control panel? and also I would need it to check and remove user accounts which havent been modified or accessed within the last 2 months.

Disk Cleaner...

I presume thats an alteernative to regseeker? I will have a look into it when I get a little time if I am right in thinking that thats for that much appreciated!!!

I take it then the mass of code below that is the code needed to clean up the registry and remove like temoray internet files etc? I mean I can possibly guess as some of it????

Many Thanks for you input thats great... I will throw it into a vbs and see what happens at some point and have a play but at the moment I am just on my way out!!!

Thanks again!!!!!! :)

James

(in reply to gdewrance)
 
 
Post #: 22
 
 RE: Run Maintenance on a PC through Script. - 9/6/2006 9:08:10 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
this page my help with your questions on cleanmgr

http://www.ss64.com/nt/cleanmgr.html



Open The Command Prompt
START
RUN


cleanmgr /sageset:x (i recommend x=1) cleanmgr /sageset:1

a box will popup, then check mark all the items and click OK

then type:

cleanmgr /sagerun:x (if you choose 1...type 1) cleanmgr /sagerun:1

now...you can use the cleanmgr /sagerun:x as many times you want, ok ?... sageset is just one time or ...define it as many times you want it, by the way.. x is a # betwheen 0 and 65235

< Message edited by gdewrance -- 9/6/2006 9:14:45 PM >

(in reply to morpheus83uk)
 
 
Post #: 23
 
 RE: Run Maintenance on a PC through Script. - 9/12/2006 2:23:26 AM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
hello,

I have followed the instructions on the website you have provided.

What happens with teh disk cleanup when I use the example the guy has on that website I use the same reg file as him and point it to the correct directory and everything and it runs gets to looking for the files to cleanup and then it just goes away....

Any ideas??

I will have a play with the other stuff you have posted hopefully a little later today :)

Many Thanks

James


(in reply to gdewrance)
 
 
Post #: 24
 
 RE: Run Maintenance on a PC through Script. - 9/12/2006 5:10:00 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
I would have just run sageset number and extracted my own reg settings to install to other computers as this sets the flag value. then just use sagerun number to execute it

(in reply to morpheus83uk)
 
 
Post #: 25
 
 RE: Run Maintenance on a PC through Script. - 9/13/2006 11:33:38 PM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Thanks for that I have done that and it seems to work... I will test on another PC to make sure all goes well...

As for the whole deleting a user thing I have been told about delprof which would work fine....

I cant seem to find out a way of deleting the Account Unknown Profiles uless that code above does that? If it does how could it be modified to remove ALL the Account Unkown Profiles?

Many Thanks

James

(in reply to gdewrance)
 
 
Post #: 26
 
 RE: Run Maintenance on a PC through Script. - 9/14/2006 1:49:58 AM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Ok I have the following Code:

[Code]

'Install DELPROF
set WshShell = CreateObject("WScript.Shell")
WshShell.Run "\\scnsmssrvr\Software\Maintenance\delprof.msi"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{UP}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ENTER}"
'Run Delprof Silently
WshShell.Run "cmd /c "c: && cd "\Program Files\Windows Resource Kits\Tools\" && delprof /q /d:62"
WshShell.SendKeys "{ENTER}"

[/Code]

It tellls me that it its expecting an end of statement when it gets to:

WshShell.Run "cmd /c "c

Any ideas why? or how I can rectify the problem?

Many Thanks

James

(in reply to morpheus83uk)
 
 
Post #: 27
 
 RE: Run Maintenance on a PC through Script. - 9/18/2006 11:04:49 PM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Hello,

Has anyone got any ideas on how I might be able to do this?

I am working on one part of this at a time now so I dont get all confused...

Many Thanks

James

(in reply to morpheus83uk)
 
 
Post #: 28
 
 RE: Run Maintenance on a PC through Script. - 9/18/2006 11:14:11 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
you may want to look here http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/usersgroups/localusers/

here are some scripts http://www.cruto.com/resources/vbscript/vbscript-examples/vbscript-sitemap.asp

< Message edited by gdewrance -- 9/18/2006 11:18:52 PM >

(in reply to morpheus83uk)
 
 
Post #: 29
 
 RE: Run Maintenance on a PC through Script. - 9/24/2006 7:26:10 PM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Hi,

Thanks for them I have pulled some stuff off there...

Any ideas on how I can get my code to work though? with the command line I am trying to run?

Many Thanks

James

(in reply to gdewrance)
 
 
Post #: 30
 
 RE: Run Maintenance on a PC through Script. - 9/26/2006 11:28:27 PM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Hello,

I have the following code:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
   ("Select * from Win32_Product Where Name = 'Netscape Communicator 4.7'")
For Each objSoftware in colSoftware
   objSoftware.Uninstall()
Next

Thing is it does not actually remove netscape navigator...

Anyone any ideas on this?

Many Thanks

James

(in reply to morpheus83uk)
 
 
Post #: 31
 
 RE: Run Maintenance on a PC through Script. - 9/26/2006 11:51:04 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
try modifying this


const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
          strComputer & "\root\default:StdRegProv")
Set WshShell = WScript.CreateObject("WScript.Shell")


' Uninstall first application...
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\1st JavaScript Editor 3" '<--- change as needed
strValueName = "UninstallString"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strUninstallFullPath
If IsNull(strUninstallFullPath) Then
  ' wscript.echo "Uninstall path for app1 is null"
Else
  ' the following line -y switch suppresses the confirmation question from poping up
  strUninstallFullPath=strUninstallFullPath & " -y"                                 '<--- change as needed
  WshShell.Run strUninstallFullPath,8,true
End If

' Uninstall second application...
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SomeOtherApp"      '<--- change as needed
strValueName = "UninstallString"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strUninstallFullPath
If IsNull(strUninstallFullPath) Then
  ' wscript.echo "Uninstall path for app2 is null"
Else
  WshShell.Run strUninstallFullPath,8,true
End If

Set WshShell = Nothing
Set oReg = Nothing

(in reply to morpheus83uk)
 
 
Post #: 32
 
 RE: Run Maintenance on a PC through Script. - 9/27/2006 6:45:32 PM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Hello,

Thanks for that it runs the uninstaller which is great but thing is I get an Error telling me the DEINSTALL path is not found....

I have found the Deinstall path which is located:

HKEY_LOCAL_MACHINE\Software\Netscape\Deinstall\4.7 (en)

In there theere are 2 keys one which are:

Deinstall Exe
Deinstall File Path

Anyone know where I put the path for the deinstall so it can continue removeing the application?

Its all slowely coming together and I am learning loads thats to you all! :)

Many Thanks

James

< Message edited by morpheus83uk -- 9/27/2006 6:50:36 PM >

(in reply to gdewrance)
 
 
Post #: 33
 
 RE: Run Maintenance on a PC through Script. - 9/27/2006 7:04:46 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
did you check the path in the registry that the uninstall key points to

(in reply to morpheus83uk)
 
 
Post #: 34
 
 RE: Run Maintenance on a PC through Script. - 9/27/2006 9:01:29 PM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
The path the registry points to is:

C:\WINDOWS\cd32.exe 4.7 (en)

so I presume the above exe runs it???

Possibly?

Or do we need to modify something first?

Many Thanks

James

(in reply to gdewrance)
 
 
Post #: 35
 
 RE: Run Maintenance on a PC through Script. - 10/9/2006 11:43:15 PM   
  morpheus83uk

 

Posts: 435
Score: 0
Joined: 8/21/2006
Status: offline
Does anyone in here know how I could get the code to remove netscape for me with any modifications?

Oh and about the delprof thing anyone got any suggestions on how I can get it to work?

Many Thanks

James

(in reply to morpheus83uk)
 
 
Post #: 36
 
 
Page:  <<   < prev  1 [2]
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: Run Maintenance on a PC through Script. Page: <<   < prev  1 [2]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts