[THIN] Re: Moving the Windows Pagefile by scripts ?

  • From: "Andrew Wood" <andrew.wood@xxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Thu, 13 Apr 2006 10:43:26 +0100

Shane, 
 
Not in a .cmd file I'm afraid - afaik you'd be better off using using
vbscript
 
Heres a script example that can be run as part of your unattended install
that'll blank the pagefile on c: and create a new pagefile on d:
 
hth
 
 
Dim strComputer
 
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPageFiles = objWMIService.ExecQuery  ("Select * from
Win32_PageFileSetting")
 
For Each objPageFile in colPageFiles
    wscript.echo objPagefile.Name
 
    If objPagefile.Name = "C:\pagefile.sys" Then
       objPageFile.InitialSize = 0
       objPageFile.MaximumSize = 0
    End If 
 
    objPageFile.InitialSize = 2500
    objPagefile.Name = "d:\pagefile.sys"
    objPageFile.MaximumSize = 4000
    
    objPageFile.Put_
Next

  _____  

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Shane A Broomhall (Aust)
Sent: 12 April 2006 22:55
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Moving the Windows Pagefile by scripts ?



HI All,

 

I am working for a company who builds its servers via RIS, and then uses
scripts to modify them for specific services.  What we are hoping to be able
to do is to be able to specify that our page file will be on a different
partition D or E, and a fixed size in the script which does this
modification. The current scripts are batch (CMD) files.

 

Can anyone provide me with some tips on how to get the pagefile moved and to
a specific size ?

 

We are using Windows 2003 server Service Pack 1.

 

Thanks in advance

 

 

Shane Broomhall

 

Australia

 

Other related posts: