MSFN Forum: VBS To Lower Some Processes - MSFN Forum

Jump to content



Windows Vista Forum Rules

If you have questions about customizing Windows Vista that are vLite-specific, please post them in the vLite forum, not here. If you have questions regarding the unattended installation of Windows Vista, please post them in the Unattended Windows Vista/Server 2008 section.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

VBS To Lower Some Processes Rate Topic: -----

#1 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,021
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 21 July 2006 - 04:08 AM

Here is a VBS script that will lower these services

Quote

'/-> Array For Services To Lower
 Dim ObjPro	  : ObjPro = Array(_
	"SearchFilterHost.exe", "SearchIndexer.exe", "SearchProtocolHost.exe",_
	"SLsvc.exe", "spoolsv.exe", "TrustedInstaller.exe", "wmpnscfg.exe")

I choosed these services to lower instead of turning them off. I have this start from the All User Start Menu.
Script
Save as LowerVistaServices.vbs

Quote

'/-> Priority Level For TaskManager 
 Const Normal = 32
 Const Low = 64
 Const High = 256
 Const RealTime = 128
 Const BELOW_NORMAL = 16384
 Const Above_Normal = 32768
'/-> Varibles 
 WScript.Sleep 15000
  Dim strComputer : strComputer = "."
  Dim ColPro, ObjWmi, ObjPro, objProcess, StrObj, StrRpt
'/-> Array For Services 
   ObjPro = Array("SearchFilterHost.exe", "SearchIndexer.exe", "SearchProtocolHost.exe",_
	"SLsvc.exe", "TrustedInstaller.exe", "wmpnscfg.exe")
   
   Set ObjWmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
'/-> Collect The Array Names, Then Turn Down The Service
	For Each StrObj In ObjPro
	 Set colProcesses = ObjWmi.ExecQuery _
	  ("Select * from Win32_Process Where Name = '" & StrObj & "'")
	   For Each objProcess in colProcesses
	   objProcess.SetPriority(Low) 
	  StrRpt = StrRpt & vbCrLf & objProcess.Name 
	 Next
   Next 
   
   CreateObject("Wscript.Shell").Popup "Completed Lowering The Priority Levels" &_
   vbCrLf & StrRpt, 3,"Completed", 0 + 32


This is the VBS script I use to install it from the SFX file included

Quote

Const ALL_USERS_STARTUP = &H18&
 Const OverwriteExisting = TRUE
  Dim Shell : Set Shell = CreateObject("Shell.Application")
  Dim Fso   : Set Fso = CreateObject("Scripting.FileSystemObject")
  Dim Act   : Set Act = CreateObject("Wscript.Shell")
  Dim Vbs1, Vbs2, AllUserStart
   Vbs1 = Act.ExpandEnvironmentStrings("%SystemDrive%\LowerVistaServices.vbs")
   Vbs2 = Act.ExpandEnvironmentStrings("%SystemDrive%\InstallLowerProcess.vbs")
   Set objFolder = Shell.Namespace(ALL_USERS_STARTUP)
   Set objFolderItem = objFolder.Self
	  AllUserStart = objFolderItem.Path
	 If Fso.FileExists(Vbs1) Then 
	  Fso.CopyFile(Vbs1), (AllUserStart & "\\LowerVistaServices.vbs"), OverwriteExisting	  
	   Act.Popup "Confirm Installed Completed" & Space(7) & Vbs1, 3, "Completed", 0 + 32
	  Act.Run(Chr(34) & Vbs1 & Chr(34)), 1, True 
	 End If 
	If Fso.FileExists(Vbs1) Then Fso.DeleteFile(Vbs1) End If 
	If Fso.FileExists(Vbs2) Then Fso.DeleteFile(Vbs2) End If


I have made the above 2 Vbs Script into 1 here is the updated script
Save As LowerSvcInstall.vbs

Quote

Const ALL_USERS_STARTUP = &H18&, OverwriteExisting = TRUE
 Dim Shell   : Set Shell = CreateObject("Shell.Application")
 Dim Fso	 : Set Fso = CreateObject("Scripting.FileSystemObject")
 Dim Act	 : Set Act = CreateObject("Wscript.Shell")
 Dim Vbs1	: Vbs1 = Act.ExpandEnvironmentStrings("%SystemDrive%\LowerSvcInstall.vbs") 
 Dim StrFldr : Set StrFldr = Shell.Namespace(ALL_USERS_STARTUP)
 Dim FldrObj : Set FldrObj = StrFldr.Self
 Dim AUStart : AUStart = FldrObj.Path
 Dim Vbs2	: Vbs2 = (AUStart & "\VistaLowerSrv.vbs")
'/-> Create The Vbs Script For All User Start Menu 
 Dim Ts	  : Set Ts = Fso.CreateTextFile(Vbs2) 
   Ts.WriteLine "'/-> Priority Level For TaskManager" 
   Ts.WriteLine " Const Normal = 32, Low = 64, High = 256, RealTime = 128"
   Ts.WriteLine " Const BELOW_NORMAL = 16384, Above_Normal = 32768"
   Ts.WriteLine "'/-> Varibles" 
   Ts.WriteLine "  WScript.Sleep 15000"
   Ts.WriteLine " Dim strComputer : strComputer = ""."""
   Ts.WriteLine " Dim Act		 : Set Act = CreateObject(""Wscript.Shell"")"
   Ts.WriteLine " Dim ObjWmi	  : Set ObjWmi = GetObject(""winmgmts:\\"" & strComputer & ""\root\cimv2"")"
   Ts.WriteLine "'/-> Array For Services To Lower" 
   Ts.WriteLine " Dim ObjPro	  : ObjPro = Array(_"
   Ts.WriteLine "	""SearchFilterHost.exe"", ""SearchIndexer.exe"", ""SearchProtocolHost.exe"",_"
   Ts.WriteLine "	""SLsvc.exe"", ""spoolsv.exe"", ""TrustedInstaller.exe"", ""wmpnscfg.exe"")"  
   Ts.WriteLine "'/-> Varibles"
   Ts.WriteLine " Dim ColPro, ColSrv, ObjSrv, StrObj, StrRpt"
   Ts.WriteLine "'/-> Collect The Array Names, Then Turn Down The Service"
   Ts.WriteLine "  For Each StrObj In ObjPro"
   Ts.WriteLine "  Set ColSrv = ObjWmi.ExecQuery(""Select * from Win32_Process Where Name = '"" & StrObj & ""'"")"
   Ts.WriteLine "   For Each ObjSrv in ColSrv"
   Ts.WriteLine "	ObjSrv.SetPriority(Low)" 
   Ts.WriteLine "	StrRpt = StrRpt & vbCrLf & Space(3) & ObjSrv.Name" 
   Ts.WriteLine "	Next"
   Ts.WriteLine "   Next"
   Ts.WriteLine "  Act.Popup ""Completed Lowering The Priority Levels"" & StrRpt, 5,""Completed"", 0 + 32 + 4096"
   Ts.Close  
	If Fso.FileExists(Vbs2) Then 
	 Act.Popup "Confirm Installed Completed" , 3, "Completed", 0 + 32 + 4096
	 Act.Run(Chr(34) & Vbs2 & Chr(34)),0,True 
	End If 
   If Fso.FileExists(Vbs1) Then Fso.DeleteFile(Vbs1) End If

Attached File(s)


This post has been edited by gunsmokingman: 19 August 2006 - 01:29 AM



#2 User is offline   fizban2 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,898
  • Joined: 14-April 05
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 July 2006 - 07:04 AM

very nice GSM,
do you see a big difference with these services lowered?

#3 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,021
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 21 July 2006 - 10:58 AM

It could be me but there seems to some speed improvement.

#4 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,021
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 19 August 2006 - 01:32 AM

I have made some changes to the SFX file,there was 2 vbs script inside the first one
this now is only 1 vbs script. I have it make a Vbs Script in the all user start menu.

Quote

Const ALL_USERS_STARTUP = &H18&, OverwriteExisting = TRUE
 Dim Shell   : Set Shell = CreateObject("Shell.Application")
 Dim Fso	 : Set Fso = CreateObject("Scripting.FileSystemObject")
 Dim Act	 : Set Act = CreateObject("Wscript.Shell")
 Dim Vbs1	: Vbs1 = Act.ExpandEnvironmentStrings("%SystemDrive%\LowerSvcInstall.vbs") 
 Dim StrFldr : Set StrFldr = Shell.Namespace(ALL_USERS_STARTUP)
 Dim FldrObj : Set FldrObj = StrFldr.Self
 Dim AUStart : AUStart = FldrObj.Path
 Dim Vbs2	: Vbs2 = (AUStart & "\VistaLowerSrv.vbs")
'/-> Create The Vbs Script For All User Start Menu 
 Dim Ts	  : Set Ts = Fso.CreateTextFile(Vbs2) 
   Ts.WriteLine "'/-> Priority Level For TaskManager" 
   Ts.WriteLine " Const Normal = 32, Low = 64, High = 256, RealTime = 128"
   Ts.WriteLine " Const BELOW_NORMAL = 16384, Above_Normal = 32768"
   Ts.WriteLine "'/-> Varibles" 
   Ts.WriteLine "  WScript.Sleep 15000"
   Ts.WriteLine " Dim strComputer : strComputer = ""."""
   Ts.WriteLine " Dim Act		 : Set Act = CreateObject(""Wscript.Shell"")"
   Ts.WriteLine " Dim ObjWmi	  : Set ObjWmi = GetObject(""winmgmts:\\"" & strComputer & ""\root\cimv2"")"
   Ts.WriteLine "'/-> Array For Services To Lower" 
   Ts.WriteLine " Dim ObjPro	  : ObjPro = Array(_"
   Ts.WriteLine "	""SearchFilterHost.exe"", ""SearchIndexer.exe"", ""SearchProtocolHost.exe"",_"
   Ts.WriteLine "	""SLsvc.exe"", ""spoolsv.exe"", ""TrustedInstaller.exe"", ""wmpnscfg.exe"")"  
   Ts.WriteLine "'/-> Varibles"
   Ts.WriteLine " Dim ColPro, ColSrv, ObjSrv, StrObj, StrRpt"
   Ts.WriteLine "'/-> Collect The Array Names, Then Turn Down The Service"
   Ts.WriteLine "  For Each StrObj In ObjPro"
   Ts.WriteLine "  Set ColSrv = ObjWmi.ExecQuery(""Select * from Win32_Process Where Name = '"" & StrObj & ""'"")"
   Ts.WriteLine "   For Each ObjSrv in ColSrv"
   Ts.WriteLine "	ObjSrv.SetPriority(Low)" 
   Ts.WriteLine "	StrRpt = StrRpt & vbCrLf & Space(3) & ObjSrv.Name" 
   Ts.WriteLine "	Next"
   Ts.WriteLine "   Next"
   Ts.WriteLine "  Act.Popup ""Completed Lowering The Priority Levels"" & StrRpt, 5,""Completed"", 0 + 32 + 4096"
   Ts.Close  
	If Fso.FileExists(Vbs2) Then 
	 Act.Popup "Confirm Installed Completed" , 3, "Completed", 0 + 32 + 4096
	 Act.Run(Chr(34) & Vbs2 & Chr(34)),0,True 
	End If 
   If Fso.FileExists(Vbs1) Then Fso.DeleteFile(Vbs1) End If


Up Dated LowerVistaSrv.exe

This post has been edited by gunsmokingman: 19 August 2006 - 01:36 AM


#5 User is offline   fizban2 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,898
  • Joined: 14-April 05
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 August 2006 - 08:21 AM

wow,

i have seen a very nice speed improvement with the services lowered. Very nice GSM :) keep it up

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy