Ok.. Here is another script to learn today. Its called pagefileconfig.vbs. These scripts is installed by default in windows 2003 servers. As the name suggest, this script can be used to change, delete, create and query the characteristics of the pagefile component in windows.
Let me bring you step by step on how to create a pagefile for a system using this script. Now from command line, make sure you are in the windows>system32 directory if not you will be prompted with a dialog box like this:
So now, if you will have a lot of .vbs scripts to run you can set that cscript will be called every time you run a vbscript. Now, when I say everytime, that means everytime, even when you close the command prompt window. So to set the cscript to run automatically when you use a vbscript type:
cscript //H:cscript //S
Ok you are done now you can check the script by typing:
pagefileconfig /create /I 4096 /M 5120 /VO C: /SYS
/I is initialsize, /M is maximum size and /VO is volumeletter and /SYS is system managed pagefile.
Pretty straight forward. For changing the size of the pagefile just use:
pagefileconfig /change /I 4096 /M 5120 /VO C: /SYS
One you have changed it, you will be prompted by this message:
Now the third option of this simple but nice script is query:
pagefileconfig /query /FO list
I believe the only options, that you will like to play with will the formatted output, here it gives you table, csv and list options. So choose your option and pipe it to another file and you will get e.g. your csv file that you can open in Excel. Now thats cool.
And last is the delete option:
pagefileconfig /delete /VO C:
Basically deletes the paging file on the c volume. Mind you that you must have the local administrators privilage while doing all this work. If you don’t you can elevate your prilivages by using another account by adding /u and /p for password in the same command line that I have typed above.