Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3941 lines
200 KiB

  1. '******************************************************************************
  2. '*
  3. '* Copyright (c) Microsoft Corporation. All rights reserved.
  4. '*
  5. '* Module Name: PAGEFILECONFIG.vbs
  6. '*
  7. '* Abstract: Enables an administrator to display and configure
  8. '* a systems Virtual Memory paging file settings.
  9. '*
  10. '*
  11. '******************************************************************************
  12. OPTION EXPLICIT
  13. ON ERROR RESUME NEXT
  14. Err.Clear
  15. '******************************************************************************
  16. ' Start of Localization Content
  17. '******************************************************************************
  18. ' Valid volume pattern [ a,b drives are invalid ]
  19. CONST L_VolumePatternFormat_Text = "^([b-zB-Z]:|\*)$"
  20. ' constants for showresults
  21. CONST L_Na_Text = "N/A"
  22. CONST L_MachineName_Text = "System Name"
  23. CONST L_User_Text = "User"
  24. CONST L_Password_Text = "Password"
  25. CONST L_Intsize_Text = "Initial Size"
  26. CONST L_Maxsize_Text = "Maximum Size"
  27. CONST L_Volume_Text = "Volume Name"
  28. CONST L_Format_Text = "Format"
  29. ' the column headers used in the output display
  30. CONST L_ColHeaderHostname_Text = "Host Name"
  31. CONST L_ColHeaderDrive_Text = "Drive/Volume"
  32. CONST L_ColHeaderVolumeLabel_Text = "Volume Label"
  33. CONST L_ColHeaderFileName_Text = "Location\File Name"
  34. CONST L_ColHeaderInitialSize_Text = "Initial Size"
  35. CONST L_ColHeaderMaximumSize_Text = "Maximum Size"
  36. CONST L_ColHeaderCurrentSize_Text = "Current Size"
  37. CONST L_ColHeaderPageFileStatus_Text = "Page File Mode"
  38. CONST L_ColHeaderFreeSpace_Text = "Total Free Space"
  39. CONST L_ColHeaderTotalMinimumSize_Text = "Total (All Drives): Minimum Size"
  40. CONST L_ColHeaderTotalRecommendedSize_Text = "Total (All Drives): Recommended Size"
  41. CONST L_ColHeaderTotalSize_Text = "Total (All Drives): Currently Allocated"
  42. ' Maximum Column Header Lengths used to display various fields.
  43. ' Localization team can adjust these columns to fit the localized strings.
  44. ' constants for data lengths for ShowResults (15,13,13,19,20,20,20,22)
  45. CONST L_CONST_HOSTNAME_Length_Text = 15
  46. CONST L_CONST_DRIVENAME_Length_Text = 19
  47. CONST L_CONST_VOLLABEL_Length_Text = 17
  48. CONST L_CONST_PAGEFILENAME_Length_Text = 19
  49. CONST L_CONST_INTSIZE_Length_Text = 20
  50. CONST L_CONST_MAXSIZE_Length_Text = 20
  51. CONST L_CONST_CURRENTSIZE_Length_Text = 20
  52. CONST L_CONST_FREESPACE_Length_Text = 22
  53. CONST L_ColHeaderPageFileStatusLength_Text = 20
  54. ' constants for data lengths for ShowResults (15,33,37,40)
  55. CONST L_CONST_TOTALMINSIZE_Length_Text = 33
  56. CONST L_CONST_TOTALRECSIZE_Length_Text = 37
  57. CONST L_CONST_TOTALSIZE_Length_Text = 40
  58. ' user reply for the warning messages
  59. CONST L_UserReplyYes_Text = "y"
  60. CONST L_UserReplyNo_Text = "n"
  61. 'Constants for indication of page file status
  62. CONST L_CONST_System_Managed_Text = "System Managed"
  63. CONST L_Custom_Text = "Custom"
  64. ' constants for CScript usage
  65. CONST L_UseCscript1_ErrorMessage = "This script should be executed from the command prompt using CSCRIPT.EXE."
  66. CONST L_UseCscript2_ErrorMessage = "For example: CSCRIPT %windir%\System32\PAGEFILECONFIG.vbs <arguments>"
  67. CONST L_UseCscript3_ErrorMessage = "To set CScript as the default application to run .vbs files, run the following:"
  68. CONST L_UseCscript4_ErrorMessage = " CSCRIPT //H:CSCRIPT //S"
  69. CONST L_UseCscript5_ErrorMessage = "You can then run ""%windir%\System32\PAGEFILECONFIG.vbs <arguments>"" without preceding the script with CSCRIPT."
  70. ' common constants for showing help for all the options
  71. CONST L_UsageDescription_Text = "Description:"
  72. CONST L_UsageParamList_Text = "Parameter List:"
  73. CONST L_UsageExamples_Text = "Examples:"
  74. CONST L_UsageMachineName_Text = " /S system Specifies the remote system to connect to."
  75. CONST L_UsageUserNameLine1_Text = " /U [domain\]user Specifies the user context under which"
  76. CONST L_UsageUserNameLine2_Text = " the command should execute."
  77. CONST L_UsagePasswordLine1_Text = " /P password Specifies the password for the given"
  78. CONST L_UsagePasswordLine2_Text = " user context."
  79. ' constants for showing help
  80. CONST L_ShowUsageLine02_Text = "PAGEFILECONFIG.vbs /parameter [arguments]"
  81. CONST L_ShowUsageLine05_Text = " Enables an administrator to display and configure a system's "
  82. CONST L_ShowUsageLine06_Text = " paging file Virtual Memory settings."
  83. CONST L_ShowUsageLine08_Text = "Parameter List:"
  84. CONST L_ShowUsageLine09_Text = " /Change Changes a system's existing paging file"
  85. CONST L_ShowUsageLine10_Text = " Virtual Memory settings."
  86. CONST L_ShowUsageLine12_Text = " /Create Creates/Adds an additional ""Paging File"" to a system."
  87. CONST L_ShowUsageLine14_Text = " /Delete Deletes a ""Paging File"" from a system."
  88. CONST L_ShowUsageLine16_Text = " /Query Displays a system's paging file"
  89. CONST L_ShowUsageLine17_Text = " Virtual Memory settings."
  90. CONST L_ShowUsageLine19_Text = "Examples:"
  91. CONST L_ShowUsageLine20_Text = " PAGEFILECONFIG.vbs"
  92. CONST L_ShowUsageLine21_Text = " PAGEFILECONFIG.vbs /?"
  93. CONST L_ShowUsageLine22_Text = " PAGEFILECONFIG.vbs /Change /?"
  94. CONST L_ShowUsageLine23_Text = " PAGEFILECONFIG.vbs /Create /?"
  95. CONST L_ShowUsageLine24_Text = " PAGEFILECONFIG.vbs /Delete /?"
  96. CONST L_ShowUsageLine25_Text = " PAGEFILECONFIG.vbs /Query /?"
  97. ' constants for showing help for /Change option
  98. CONST L_ShowChangeUsageLine02_Text = "PAGEFILECONFIG.vbs /Change [/S system [/U username [/P password]]]"
  99. CONST L_ShowChangeUsageLine03_Text = " { { [/I initialsize] [/M maximumsize] } | { /SYS } }"
  100. CONST L_ShowChangeUsageLine04_Text = " /VO volume1 [/VO volume2 [... [/VO volumeN]]]"
  101. CONST L_ShowChangeUsageLine07_Text = " Changes an existing paging file's Virtual Memory Settings."
  102. CONST L_ShowChangeUsageLine18_Text = " /I initialsize Specifies the new initial size (in MB)"
  103. CONST L_ShowChangeUsageLine19_Text = " to use for the paging file specified."
  104. CONST L_ShowChangeUsageLine21_Text = " /M maximumsize Specifies the new maximum size (in MB)"
  105. CONST L_ShowChangeUsageLine22_Text = " to use for the paging file specified."
  106. CONST L_ShowChangeUsageLine24_Text = " /SYS systemmanaged Specifies that the page file has to "
  107. CONST L_ShowChangeUsageLine25_Text = " be managed by the system."
  108. CONST L_ShowChangeUsageLine27_Text = " /VO volumeletter Specifies the local drive who's paging"
  109. CONST L_ShowChangeUsageLine28_Text = " file settings need to be changed. Specify"
  110. CONST L_ShowChangeUsageLine29_Text = " '*' to select all the local drives."
  111. CONST L_ShowChangeUsageLine30_Text = " Example: ""C:"" or ""*"""
  112. CONST L_ShowChangeUsageLine33_Text = " PAGEFILECONFIG.vbs /Change /?"
  113. CONST L_ShowChangeUsageLine34_Text = " PAGEFILECONFIG.vbs /Change /M 400 /VO c:"
  114. CONST L_ShowChangeUsageLine35_text = " PAGEFILECONFIG.vbs /Change /VO c: /SYS"
  115. CONST L_ShowChangeUsageLine36_Text = " PAGEFILECONFIG.vbs /Change /S system /U user /M 400 /VO c:"
  116. CONST L_ShowChangeUsageLine37_Text = " PAGEFILECONFIG.vbs /Change /S system /U user /I 20 /VO *"
  117. CONST L_ShowChangeUsageLine38_Text = " PAGEFILECONFIG.vbs /Change /S system /U user /P password /I 200"
  118. CONST L_ShowChangeUsageLine39_Text = " /M 500 /VO c: /VO d:"
  119. ' constants for showing help for /Create option
  120. CONST L_ShowCreateUsageLine02_Text = "PAGEFILECONFIG.vbs /Create [/S system [/U username [/P password]]]"
  121. CONST L_ShowCreateUsageLine03_Text = " { {/I initialsize /M maximumsize} | { /SYS } }"
  122. CONST L_ShowCreateUsageLine04_Text = " /VO volume1 [/VO volume2 [... [/VO volumeN]]]"
  123. CONST L_ShowCreateUsageLine07_Text = " Creates/Adds an additional ""Paging File"" to a system."
  124. CONST L_ShowCreateUsageLine18_Text = " /I initialsize Specifies the initial size (in MB) to use"
  125. CONST L_ShowCreateUsageLine19_Text = " for the paging file being created."
  126. CONST L_ShowCreateUsageLine21_Text = " /M maximumsize Specifies the maximum size (in MB) to use"
  127. CONST L_ShowCreateUsageLine22_Text = " for the paging file being created."
  128. CONST L_ShowCreateUsageLine24_Text = " /SYS systemmanaged Specifies that the page file has to "
  129. CONST L_ShowCreateUsageLine25_Text = " be managed by the system."
  130. CONST L_ShowCreateUsageLine27_Text = " /VO volumeletter Specifies the local drive on which the"
  131. CONST L_ShowCreateUsageLine28_Text = " paging file has to be created. Specify '*'"
  132. CONST L_ShowCreateUsageLine29_Text = " to select all the local drives."
  133. CONST L_ShowCreateUsageLine30_Text = " Example: ""C:"" or ""*"""
  134. CONST L_ShowCreateUsageLine33_Text = " PAGEFILECONFIG.vbs /Create /?"
  135. CONST L_ShowCreateUsageLine34_Text = " PAGEFILECONFIG.vbs /Create /I 140 /M 300 /VO d:"
  136. CONST L_ShowCreateUsageLine35_Text = " PAGEFILECONFIG.VBS /Create /VO c: /SYS"
  137. CONST L_ShowCreateUsageLine36_Text = " PAGEFILECONFIG.vbs /Create /S system /U user /I 150 /M 300 /VO d:"
  138. CONST L_ShowCreateUsageLine37_Text = " PAGEFILECONFIG.vbs /Create /S system /U user /I 50 /M 200 /VO *"
  139. CONST L_ShowCreateUsageLine38_Text = " PAGEFILECONFIG.vbs /Create /S system /U user /P password /I 100"
  140. CONST L_ShowCreateUsageLine39_Text = " /M 600 /VO d: /VO e: /VO f:"
  141. ' constants for showing help for /Delete option
  142. CONST L_ShowDeleteUsageLine02_Text = "PAGEFILECONFIG.vbs /Delete [/S system [/U username [/P password]]]"
  143. CONST L_ShowDeleteUsageLine03_Text = " /VO volume1 [/VO volume2 [... [/VO volumeN]]]"
  144. CONST L_ShowDeleteUsageLine06_Text = " Deletes paging file(s) from a system."
  145. CONST L_ShowDeleteUsageLine17_Text = " /VO volumeletter Specifies the local drive who's paging"
  146. CONST L_ShowDeleteUsageLine18_Text = " file has to be deleted."
  147. CONST L_ShowDeleteUsageLine19_Text = " Example: ""C:"""
  148. CONST L_ShowDeleteUsageLine22_Text = " PAGEFILECONFIG.vbs /Delete /?"
  149. CONST L_ShowDeleteUsageLine23_Text = " PAGEFILECONFIG.vbs /Delete /VO d:"
  150. CONST L_ShowDeleteUsageLine24_Text = " PAGEFILECONFIG.vbs /Delete /S system /U user /VO d: /VO e:"
  151. CONST L_ShowDeleteUsageLine25_Text = " PAGEFILECONFIG.vbs /Delete /S system /U user /P password /VO d:"
  152. ' constants for showing help for /Query option
  153. CONST L_ShowQueryUsageLine02_Text = "PAGEFILECONFIG.vbs /Query [/S system [/U username [/P password]]]"
  154. CONST L_ShowQueryUsageLine03_Text = " [/FO format] [/NH]"
  155. CONST L_ShowQueryUsageLine06_Text = " Displays a system's paging file Virtual Memory settings."
  156. CONST L_ShowQueryUsageLine17_Text = " /FO format Specifies the format in which the output"
  157. CONST L_ShowQueryUsageLine18_Text = " is to be displayed."
  158. CONST L_ShowQueryUsageLine19_Text = " Valid values: ""TABLE"", ""LIST"", ""CSV""."
  159. CONST L_ShowQueryUsageLine21_Text = " /NH Specifies that the ""Column Header"" should"
  160. CONST L_ShowQueryUsageLine22_Text = " not be displayed in the output."
  161. CONST L_ShowQueryUsageLine25_Text = " PAGEFILECONFIG.vbs"
  162. CONST L_ShowQueryUsageLine26_Text = " PAGEFILECONFIG.vbs /Query"
  163. CONST L_ShowQueryUsageLine27_Text = " PAGEFILECONFIG.vbs /Query /?"
  164. CONST L_ShowQueryUsageLine28_Text = " PAGEFILECONFIG.vbs /Query /FO table"
  165. CONST L_ShowQueryUsageLine29_Text = " PAGEFILECONFIG.vbs /Query /FO csv /NH"
  166. CONST L_ShowQueryUsageLine30_Text = " PAGEFILECONFIG.vbs /Query /S system /U user"
  167. CONST L_ShowQueryUsageLine31_Text = " PAGEFILECONFIG.vbs /Query /S system /U user /P password /FO LIST"
  168. ' constants for error messages
  169. CONST L_UnableToInclude_ErrorMessage = "ERROR: Unable to include the common module ""CmdLib.Wsc""."
  170. CONST L_InvalidHelpUsage_ErrorMessage = "ERROR: Invalid Help Usage. Use only /? for help."
  171. CONST L_InvalidParameter_ErrorMessage = "ERROR: Invalid argument/Option - '%1'."
  172. CONST L_InvalidInput_ErrorMessage = "ERROR: Invalid input. Please check the input values."
  173. CONST L_InvalidCredentials_ErrorMessage = "ERROR: Invalid credentials. Verify the machine, user and password given."
  174. CONST L_InvalidVolumeName_ErrorMessage = "ERROR: Invalid volume '%1' specified."
  175. CONST L_InvalidUserReply_ErrorMessage = "ERROR: Invalid choice. Enter a valid choice."
  176. CONST L_FailCreateObject_ErrorMessage = "ERROR: Unable to create object."
  177. CONST L_UnableToRetrieveInfo_ErrorMessage = "ERROR: Unable to retrieve information."
  178. CONST L_CannotCreate_ErrorMessage = "ERROR: Paging file for the specified volume '%1' cannot be created."
  179. CONST L_InvalidPhysicalDrive_ErrorMessage = "ERROR: Volume '%1' is not a valid physical drive."
  180. CONST L_UpdateFailed_ErrorMessage = "ERROR: Paging file update failed."
  181. CONST L_InvalidInitSizeValue_ErrorMessage = "ERROR: Enter a numeric value for the initial paging file size."
  182. CONST L_InvalidMaxSizeValue_ErrorMessage = "ERROR: Enter a numeric value for the maximum paging file size."
  183. CONST L_CONST_Systemmanaged_Earlier_Text = "ERROR: The page file on drive %1 is system managed. Both initial and maximum size must be specified."
  184. ' constant for hint message to show remote connectivity failure
  185. CONST L_HintCheckConnection_Message = "ERROR: Please check the system name, credentials and WMI (WBEM) service."
  186. ' constants for info. messages
  187. CONST L_PageFileDoesNotExist_ErrorMessage = "ERROR: No paging file exists on volume '%1'"
  188. CONST L_NoPageFiles_Message = "ERROR: No paging file(s) available."
  189. ' constants for Syntax Error Messages
  190. CONST L_InvalidSyntax_ErrorMessage = "ERROR: Invalid Syntax."
  191. CONST L_InvalidServerName_ErrorMessage = "ERROR: Invalid Syntax. System name cannot be empty."
  192. CONST L_InvalidUserName_ErrorMessage = "ERROR: Invalid Syntax. User name cannot be empty."
  193. CONST L_NoHeaderNotAllowed_ErrorMessage = "ERROR: /NH option is allowed only for ""TABLE"" and ""CSV"" formats."
  194. CONST L_TypeUsage_Message = "Type ""%1 /?"" for usage."
  195. CONST L_TypeCreateUsage_Message = "Type ""%1 /Create /?"" for usage."
  196. CONST L_TypeChangeUsage_Message = "Type ""%1 /Change /?"" for usage."
  197. CONST L_TypeDeleteUsage_Message = "Type ""%1 /Delete /?"" for usage."
  198. CONST L_TypeQueryUsage_Message = "Type ""%1 /Query /?"" for usage."
  199. ' constants for missing mandatory option messages
  200. CONST L_VolumeNameNotSpecified_ErrorMessage = "Mandatory option '/VO' is missing."
  201. CONST L_InitialSizeNotSpecified_ErrorMessage = "Either '/SYS' or both '/I' and '/M' are mandatory with Create option."
  202. CONST L_MaximumSizeNotSpecified_ErrorMessage = "Mandatory option '/M' is missing."
  203. CONST L_NoneoftheSizeSpecified_ErrorMessage = "Either '/SYS' or one of '/I' and '/M' are mandatory with Change option."
  204. CONST L_CONST_NoneoftheSizes_AllowedWithSysManaged_Text = "Either '/I' or '/M' can not be specified with '/SYS'."
  205. CONST L_FormatNotSpecified_ErrorMessage = "Mandatory options '/FO' is missing."
  206. ' error messages for invalid usage of s,u,p switches
  207. CONST L_InvalidServerCredentials_ErrorMessage = "ERROR: Invalid Syntax. /U can be specified only when /S is specified."
  208. CONST L_InvalidUserCredentials_ErrorMessage = "ERROR: Invalid Syntax. /P can be specified only when /U is specified."
  209. ' constants for Mutliple line Error Messages
  210. CONST L_InsufficientMaxSize1_ErrorMessage = "ERROR: The maximum paging file size on volume '%1' should be greater than or "
  211. CONST L_InsufficientMaxSize2_ErrorMessage = " equal to the initial paging file size, and less than %2 MB or less "
  212. CONST L_InsufficientMaxSize3_ErrorMessage = " than the disk size."
  213. CONST L_InitialSizeRange1_ErrorMessage = "ERROR: The initial paging file size must be between 2 MB and %1 MB, and "
  214. CONST L_InitialSizeRange2_ErrorMessage = " cannot exceed the amount of free space on the drive '%2' selected. "
  215. CONST L_NotEnoughSpace1_ErrorMessage = "ERROR: There is not enough space on the drive '%1' for the paging file"
  216. CONST L_NotEnoughSpace2_ErrorMessage = " Please enter a smaller number or free some disk space."
  217. CONST L_AtLeastFiveMB1_ErrorMessage = "ERROR: There is not enough space on the drive '%1' to create the paging file"
  218. CONST L_AtLeastFiveMB2_ErrorMessage = " size specified. At least 5 megabytes of free disk space must be left"
  219. CONST L_AtLeastFiveMB3_ErrorMessage = " after the paging file is created. Specify a smaller paging file size"
  220. CONST L_AtLeastFiveMB4_ErrorMessage = " or free some disk space."
  221. CONST L_DiskTooSmall1_ErrorMessage = "ERROR: Drive '%1' is too small for the maximum paging file size specified."
  222. CONST L_DiskTooSmall2_ErrorMessage = " Please enter a smaller number."
  223. CONST L_CannotDelete1_ErrorMessage = "ERROR: The paging file from volume '%1' cannot be deleted."
  224. CONST L_CannotDelete2_ErrorMessage = " At least one paging file must be present."
  225. ' constants for Mutliple line Warning Messages
  226. CONST L_GrowsToFreeSpaceWarning1_Message = "WARNING: Drive '%1' does not have enough free space for the maximum paging "
  227. CONST L_GrowsToFreeSpaceWarning2_Message = " file specified. If you continue with this setting, the paging file "
  228. CONST L_GrowsToFreeSpaceWarning3_Message = " will only grow to the size of the available free space (%2 MB)."
  229. CONST L_CrashDumpSettingWarning1_Message = "WARNING: If the paging file on volume '%1' has an initial size of less than"
  230. CONST L_CrashDumpSettingWarning2_Message = " %2, then the system may not be able to create a crash dump debugging"
  231. CONST L_CrashDumpSettingWarning3_Message = " information file if a STOP error (blue screen) occurs."
  232. ' constants for Multiple line SUCCESS / SKIPPING messages
  233. CONST L_ChangeIntSuccess1_Message = "SUCCESS: The initial size for the paging file on '%1' was changed from "
  234. CONST L_ChangeIntSuccess2_Message = " %2 MB to %3 MB."
  235. CONST L_ChangeMaxSuccess1_Message = "SUCCESS: The maximum size for the paging file on '%1' was changed from "
  236. CONST L_ChangeMaxSuccess2_Message = " %2 MB to %3 MB."
  237. CONST L_ChangeIntSkipping1_Message = "SKIPPING: The initial size specified for the paging file on '%1' is same as "
  238. CONST L_ChangeIntSkipping2_Message = " the present value."
  239. CONST L_ChangeMaxSkipping1_Message = "SKIPPING: The maximum size specified for the paging file on '%1' is same as "
  240. CONST L_ChangeMaxSkipping2_Message = " the present value."
  241. CONST L_CreateSuccess1_Message = "SUCCESS: A paging file with initial size of %1 MB and a maximum size "
  242. CONST L_CreateSuccess2_Message = " of %2 MB was created on the volume: '%3'"
  243. CONST L_CreateSkipping_Message = "SKIPPING: A paging file already exists on the volume: '%1'"
  244. CONST L_DeleteSuccess_Message = "SUCCESS: The paging file from volume '%1' has successfully been removed."
  245. CONST L_CreateSystemSuccess_message = "SUCCESS: The paging file of system managed size has been created on the volume: '%1'."
  246. CONST L_ChangeSystemSuccess_message = "SUCCESS: The paging file on the volume '%1' has been changed to system managed size."
  247. CONST L_CONST_Already_SystemManaged_Text = "ERROR: The page File on drive %1 is already system managed."
  248. ' constant for other error messages
  249. CONST L_InvalidFormat_ErrorMessage = "Invalid format '%1' specified."
  250. CONST L_SystemManagedSize_ErrorMessage = "ERROR: Volume '%1' is system managed."
  251. CONST L_PromptForContinueAnyWay_Message = "Continue Anyway [y/n]?"
  252. CONST L_NotAllowedMoreThanOnce_ErrorMessage = "'%1' option is not allowed more than '1' time."
  253. CONST L_RestartComputer_Message = "Restart the computer for these changes to take effect."
  254. '******************************************************************************
  255. ' END of Localization Content
  256. '******************************************************************************
  257. ' constants used for format selection
  258. CONST PatternFormat_Text = "^(table|list|csv)$"
  259. CONST DefaultFormat_Text = "list"
  260. CONST ListFormat_Text = "list"
  261. ' the main options
  262. CONST OPTION_HELP = "?"
  263. CONST OPTION_CHANGE = "change"
  264. CONST OPTION_CREATE = "create"
  265. CONST OPTION_DELETE = "delete"
  266. CONST OPTION_QUERY = "query"
  267. ' the suboptions
  268. CONST SUB_OPTION_SERVER = "s"
  269. CONST SUB_OPTION_USER = "u"
  270. CONST SUB_OPTION_PASSWORD = "p"
  271. CONST SUB_OPTION_INTSIZE = "i"
  272. CONST SUB_OPTION_MAXSIZE = "m"
  273. CONST SUB_OPTION_VOLUME = "vo"
  274. CONST SUB_OPTION_FORMAT = "fo"
  275. CONST SUB_OPTION_NOHEADER = "nh"
  276. CONST SUB_OPTION_SYSTEM_MANAGED = "sys"
  277. ' constant for CScript
  278. CONST CONST_CSCRIPT = 2
  279. ' constants for error codes
  280. CONST CONST_ERROR = 0
  281. ' constants for options
  282. CONST CONST_SHOW_USAGE = 3
  283. CONST CONST_CHANGE_OPTION = 11
  284. CONST CONST_CREATE_OPTION = 21
  285. CONST CONST_DELETE_OPTION = 31
  286. CONST CONST_QUERY_OPTION = 41
  287. ' constant for matched pattern
  288. CONST CONST_NO_MATCHES_FOUND = 0
  289. ' utility specific constants
  290. CONST INITIAL_SIZE_LB = 2
  291. CONST DRIVE_TYPE = 3
  292. CONST MEGA_BYTES = " MB"
  293. CONST SIZE_FACTOR = 1.5
  294. CONST CONVERSION_FACTOR = 1048576
  295. CONST PAGEFILE_DOT_SYS = "\pagefile.sys"
  296. CONST CONST_SYSTEM_INIT_SIZE = 0
  297. CONST CONST_SYSTEM_MAX_SIZE = 0
  298. ' constant for the UNC format server name
  299. CONST UNC_FORMAT_SERVERNAME_PREFIX = "\\"
  300. ' constants for exit values
  301. CONST EXIT_SUCCESS = 0
  302. CONST EXIT_UNEXPECTED = 255
  303. CONST EXIT_INVALID_INPUT = 254
  304. CONST EXIT_METHOD_FAIL = 250
  305. CONST EXIT_QUERY_FAIL = 253
  306. CONST EXIT_INVALID_PARAM = 999
  307. CONST EXIT_PARTIAL_SUCCESS = 128
  308. ' Define namespace and class names of wmi
  309. CONST CONST_WBEM_FLAG = 131072
  310. CONST CONST_NAMESPACE_CIMV2 = "root\cimv2"
  311. CONST CLASS_PAGE_FILE_SETTING = "Win32_PageFileSetting"
  312. CONST CLASS_LOGICAL_DISK = "Win32_LogicalDisk"
  313. CONST CLASS_COMPUTER_SYSTEM = "Win32_ComputerSystem"
  314. CONST CLASS_PAGE_FILE_USAGE = "Win32_PageFileUsage"
  315. CONST CLASS_OPERATING_SYSTEM = "Win32_OperatingSystem"
  316. CONST CLASS_PERFDISK_PHYSICAL_DISK = "Win32_PerfRawData_PerfDisk_PhysicalDisk"
  317. Dim UseCscriptErrorMessage ' string to store the CScript usage
  318. Dim blnLocalConnection ' flag for local connection
  319. Dim blnSuccessMsg ' flag for indicating if any success messages have been delivered
  320. Dim blnFailureMsg ' flag to indicate if any failure messages have been delivered
  321. Dim component ' object for the common module
  322. ' Error Messages
  323. Dim InsufficientMaxSizeErrorMessage
  324. Dim InitialSizeRangeErrorMessage
  325. Dim NotEnoughSpaceErrorMessage
  326. Dim AtLeastFiveMBErrorMessage
  327. Dim DiskTooSmallErrorMessage
  328. Dim CannotDeleteErrorMessage
  329. ' Warning Messages
  330. Dim GrowsToFreeSpaceWarningMessage
  331. Dim CrashDumpSettingWarningMessage
  332. ' Success / Skipping messages
  333. Dim ChangeIntSuccessMessage
  334. Dim ChangeMaxSuccessMessage
  335. Dim ChangeIntSkippingMessage
  336. Dim ChangeMaxSkippingMessage
  337. Dim CreateSuccessMessage
  338. InsufficientMaxSizeErrorMessage = L_InsufficientMaxSize1_ErrorMessage & vbCRLF & _
  339. L_InsufficientMaxSize2_ErrorMessage & vbCRLF & _
  340. L_InsufficientMaxSize3_ErrorMessage
  341. InitialSizeRangeErrorMessage = L_InitialSizeRange1_ErrorMessage & vbCRLF & _
  342. L_InitialSizeRange2_ErrorMessage
  343. NotEnoughSpaceErrorMessage = L_NotEnoughSpace1_ErrorMessage & vbCRLF & _
  344. L_NotEnoughSpace2_ErrorMessage
  345. AtLeastFiveMBErrorMessage = L_AtLeastFiveMB1_ErrorMessage & vbCRLF & _
  346. L_AtLeastFiveMB2_ErrorMessage & vbCRLF & _
  347. L_AtLeastFiveMB3_ErrorMessage & vbCRLF & _
  348. L_AtLeastFiveMB4_ErrorMessage
  349. DiskTooSmallErrorMessage = L_DiskTooSmall1_ErrorMessage & vbCRLF & _
  350. L_DiskTooSmall2_ErrorMessage
  351. CannotDeleteErrorMessage = L_CannotDelete1_ErrorMessage & vbCRLF & _
  352. L_CannotDelete2_ErrorMessage
  353. GrowsToFreeSpaceWarningMessage = L_GrowsToFreeSpaceWarning1_Message & vbCRLF & _
  354. L_GrowsToFreeSpaceWarning2_Message & vbCRLF & _
  355. L_GrowsToFreeSpaceWarning3_Message
  356. CrashDumpSettingWarningMessage = L_CrashDumpSettingWarning1_Message & vbCRLF & _
  357. L_CrashDumpSettingWarning2_Message & vbCRLF & _
  358. L_CrashDumpSettingWarning3_Message
  359. ChangeIntSuccessMessage = L_ChangeIntSuccess1_Message & vbCRLF & _
  360. L_ChangeIntSuccess2_Message
  361. ChangeMaxSuccessMessage = L_ChangeMaxSuccess1_Message & vbCRLF & _
  362. L_ChangeMaxSuccess2_Message
  363. ChangeIntSkippingMessage = L_ChangeIntSkipping1_Message & vbCRLF & _
  364. L_ChangeIntSkipping2_Message
  365. ChangeMaxSkippingMessage = L_ChangeMaxSkipping1_Message & vbCRLF & _
  366. L_ChangeMaxSkipping2_Message
  367. CreateSuccessMessage = L_CreateSuccess1_Message & vbCRLF & _
  368. L_CreateSuccess2_Message
  369. blnLocalConnection = FALSE
  370. blnSuccessMsg = FALSE
  371. blnFailureMsg = FALSE
  372. ' create the object for commom module
  373. Set component = CreateObject( "Microsoft.CmdLib" )
  374. ' check if the commom module(CmdLib.wsc) is not registered
  375. If Err.Number Then
  376. Err.Clear
  377. WScript.Echo(L_UnableToInclude_ErrorMessage)
  378. WScript.Quit(EXIT_METHOD_FAIL)
  379. End If
  380. ' set the scripting host to WScript
  381. Set component.ScriptingHost = WScript.Application
  382. ' Check whether the script is run using CScript
  383. If CInt(component.checkScript) <> CONST_CSCRIPT Then
  384. UseCscriptErrorMessage = L_UseCscript1_ErrorMessage & vbCRLF & _
  385. ExpandEnvironmentString(L_UseCscript2_ErrorMessage) & vbCRLF & vbCRLF & _
  386. L_UseCscript3_ErrorMessage & vbCRLF & _
  387. L_UseCscript4_ErrorMessage & vbCRLF & vbCRLF & _
  388. ExpandEnvironmentString(L_UseCscript5_ErrorMessage)
  389. WScript.Echo (UseCscriptErrorMessage)
  390. WScript.Quit(EXIT_UNEXPECTED)
  391. End If
  392. ' call the main function
  393. Call VBMain()
  394. ' quit with exit value = 0
  395. WScript.Quit(EXIT_SUCCESS)
  396. '******************************************************************************
  397. '* Sub: VBMain
  398. '*
  399. '* Purpose: This is the main function which starts execution
  400. '*
  401. '* Input: None
  402. '*
  403. '* Output: None
  404. '*
  405. '******************************************************************************
  406. Sub VBMain()
  407. ON ERROR RESUME NEXT
  408. Err.Clear
  409. ' Declaring main variables
  410. Dim strMachine ' machine to configure page files on
  411. Dim strUserName ' user name to connect to the machine
  412. Dim strPassword ' password for the user
  413. Dim intIntSize ' initial size for the page file
  414. Dim intMaxSize ' maximum size for the page file
  415. Dim strVolName ' volume name
  416. Dim objVols ' object containing volume names
  417. Dim strFormat ' query display format
  418. Dim blnNoHeader ' stores if -nh is specified or not
  419. Dim blnSystemManaged ' Specifies whether pagefile has to be system managed
  420. Dim blnInitSize ' Specifies whether /I switch is specified or not
  421. Dim blnmaxSize ' Specifies whether /M switch is specified or not
  422. Dim intMainOption ' main option specified
  423. Dim intTempResult ' temporary variable to hold the return value
  424. Dim blnValidArguments ' stores the return value of ValidateArguments
  425. ' Initializing Variables
  426. intTempResult = CONST_ERROR ' default is CONST_ERROR (=0)
  427. strFormat = DefaultFormat_Text ' default format is LIST
  428. blnInitSize = FALSE
  429. blnMaxSize = FALSE
  430. Set objVols = CreateObject("Scripting.Dictionary")
  431. objVols.CompareMode = VBBinaryCompare
  432. If Err.Number Then
  433. ' Unable to create the dictionary object.
  434. Err.Clear
  435. WScript.Echo(L_FailCreateObject_ErrorMessage)
  436. WScript.Quit(EXIT_METHOD_FAIL)
  437. End If
  438. intTempResult = intParseCmdLine( strMachine, _
  439. strUserName, _
  440. strPassword, _
  441. intIntSize, _
  442. intMaxSize, _
  443. strVolName, _
  444. objVols, _
  445. strFormat, _
  446. blnNoHeader, _
  447. blnSystemManaged, _
  448. blnInitSize, _
  449. blnMaxSize, _
  450. intMainOption )
  451. ' Select the operation specified by the user
  452. Select Case intTempResult
  453. Case CONST_SHOW_USAGE
  454. Select Case intMainOption
  455. Case CONST_CHANGE_OPTION
  456. Call ShowChangeUsage()
  457. Case CONST_CREATE_OPTION
  458. Call ShowCreateUsage()
  459. Case CONST_DELETE_OPTION
  460. Call ShowDeleteUsage()
  461. Case CONST_QUERY_OPTION
  462. Call ShowQueryUsage()
  463. Case Else
  464. Call ShowUsage()
  465. End Select
  466. Case CONST_CHANGE_OPTION
  467. blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  468. intIntSize, intMaxSize, objVols, strFormat, _
  469. blnNoHeader, blnSystemManaged, blnInitSize, _
  470. blnMaxSize, intMainOption)
  471. ' If all arguments valid, proceed
  472. If blnValidArguments Then
  473. Call ProcessChange(strMachine, strUserName, strPassword, _
  474. intIntSize, intMaxSize, blnSystemManaged, objVols)
  475. End If
  476. Case CONST_CREATE_OPTION
  477. blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  478. intIntSize, intMaxSize, objVols, strFormat, _
  479. blnNoHeader, blnSystemManaged, blnInitSize, _
  480. blnMaxSize, intMainOption)
  481. ' If all arguments valid, proceed
  482. If blnValidArguments Then
  483. Call ProcessCreate(strMachine, strUserName, strPassword, _
  484. intIntSize, intMaxSize, blnSystemManaged, objVols)
  485. End If
  486. Case CONST_DELETE_OPTION
  487. blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  488. intIntSize, intMaxSize, objVols, strFormat, _
  489. blnNoHeader, blnSystemManaged, blnInitSize, _
  490. blnMaxSize, intMainOption)
  491. ' If all arguments valid, proceed
  492. If blnValidArguments Then
  493. Call ProcessDelete(strMachine, strUserName, strPassword, blnSystemManaged, objVols)
  494. ' Here wild cards cannot be specified
  495. End If
  496. Case CONST_QUERY_OPTION
  497. blnValidArguments = ValidateArguments (strMachine, strUserName, strPassword, _
  498. intIntSize, intMaxSize, objVols, strFormat, _
  499. blnNoHeader, blnSystemManaged, blnInitSize, _
  500. blnMaxSize, intMainOption)
  501. ' If all arguments valid, proceed
  502. If blnValidArguments Then
  503. Call ProcessQuery(strMachine, strUserName, strPassword, strFormat, blnSystemManaged, blnNoHeader)
  504. End If
  505. Case CONST_ERROR
  506. WSCript.Quit(EXIT_INVALID_INPUT)
  507. End Select
  508. End Sub
  509. '******************************************************************************
  510. '* Function: intPaseCmdLine
  511. '*
  512. '* Purpose: Parses the command line arguments into the variables
  513. '*
  514. '* Input:
  515. '* [out] strMachine machine to configure page files on
  516. '* [out] strUserName user name to connect to the machine
  517. '* [out] strPassword password for the user
  518. '* [out] intIntSize initial size for the page file
  519. '* [out] intMaxSize maximum size for the page file
  520. '* [in] strVolName individual volume name(s)
  521. '* [out] objVols object containing volume names
  522. '* [out] strFormat query display format
  523. '* [out] intMainOption main option specified
  524. '*
  525. '* Output: Returns CONST_SHOW_USAGE, CONST_CHANGE_OPTION ,
  526. '* CONST_CREATE_OPTION, CONST_DELETE_OPTION ,
  527. '* CONST_QUERY_OPTION or CONST_ERROR.
  528. '* Displays error message and quits if invalid option is asked
  529. '*
  530. '******************************************************************************
  531. Private Function intParseCmdLine( ByRef strMachine, _
  532. ByRef strUserName, _
  533. ByRef strPassword, _
  534. ByRef intIntSize, _
  535. ByRef intMaxSize, _
  536. ByVal strVolName, _
  537. ByRef objVols, _
  538. ByRef strFormat, _
  539. ByRef blnNoHeader, _
  540. ByRef blnSystemManaged, _
  541. ByRef blninitSize, _
  542. ByRef blnMaxSize, _
  543. ByRef intMainOption )
  544. ON ERROR RESUME NEXT
  545. Err.Clear
  546. Dim strUserGivenArg ' to temporarily store the user given arguments
  547. Dim intArgIter ' to count the number of arguments given
  548. Dim intQCount ' to count the number of help options given
  549. Dim intMainOptionNumber ' to count the number of main operations selected (Max allowed = 1)
  550. Dim intVolumes ' to store the number of volumes specified
  551. ' Following variables are used to check if a switch if given more than once
  552. Dim blnIntSizeSpecified
  553. Dim blnMaxSizeSpecified
  554. Dim blnFormatSpecified
  555. Dim blnMachineSpecified
  556. Dim blnUserSpecified
  557. Dim blnPasswordSpecified
  558. ' Initialization
  559. strUserGivenArg = ""
  560. intMainOptionNumber = 0
  561. intQCount = 0
  562. intArgIter = 0
  563. intParseCmdLine = 0
  564. ' initially none of the parameters are specified, so set all flags to FALSE
  565. blnIntSizeSpecified = FALSE
  566. blnMaxSizeSpecified = FALSE
  567. blnFormatSpecified = FALSE
  568. blnMachineSpecified = FALSE
  569. blnUserSpecified = FALSE
  570. blnPasswordSpecified = FALSE
  571. blnNoHeader = FALSE
  572. blnSystemManaged = FALSE
  573. ' if no arguments are specified, default option is query
  574. If WScript.Arguments.Count = 0 Then
  575. intParseCmdLine = CONST_QUERY_OPTION
  576. intMainOption = CONST_QUERY_OPTION
  577. End If
  578. ' Retrieve the command line parameters and their values
  579. Do While intArgIter <= WScript.Arguments.Count - 1
  580. strUserGivenArg = WScript.Arguments.Item(intArgIter)
  581. ' check if the first character is a '-' OR '/' symbol; NOTE that "/" is the standard
  582. If Left(strUserGivenArg,1) = "/" OR Left(strUserGivenArg,1) = "-" Then
  583. ' ignore the symbol and take the rest as the switch specified
  584. strUserGivenArg = Right(strUserGivenArg,Len(strUserGivenArg) - 1)
  585. Select Case LCase(strUserGivenArg)
  586. Case LCase(OPTION_HELP)
  587. intQCount = intQCount + 1
  588. If (CInt(intQCount) >= 2 OR CInt(WScript.Arguments.Count) > 2) Then
  589. intParseCmdLine = CONST_ERROR
  590. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  591. Exit Function
  592. Else
  593. intParseCmdLine = CONST_SHOW_USAGE
  594. intArgIter = intArgIter + 1
  595. End If
  596. Case LCase(OPTION_CHANGE)
  597. If intQCount = 1 Then ' intQCount = 1 means help specified
  598. intParseCmdLine = CONST_SHOW_USAGE
  599. Else
  600. intParseCmdLine = CONST_CHANGE_OPTION
  601. End If
  602. intMainOption = CONST_CHANGE_OPTION
  603. intMainOptionNumber = intMainOptionNumber + 1
  604. intArgIter = intArgIter + 1
  605. Case LCase(OPTION_CREATE)
  606. If intQCount = 1 Then ' intQCount = 1 means help specified
  607. intParseCmdLine = CONST_SHOW_USAGE
  608. Else
  609. intParseCmdLine = CONST_CREATE_OPTION
  610. End If
  611. intMainOption = CONST_CREATE_OPTION
  612. intMainOptionNumber = intMainOptionNumber + 1
  613. intArgIter = intArgIter + 1
  614. Case LCase(OPTION_DELETE)
  615. If intQCount = 1 Then ' intQCount = 1 means help specified
  616. intParseCmdLine = CONST_SHOW_USAGE
  617. Else
  618. intParseCmdLine = CONST_DELETE_OPTION
  619. End If
  620. intMainOption = CONST_DELETE_OPTION
  621. intMainOptionNumber = intMainOptionNumber + 1
  622. intArgIter = intArgIter + 1
  623. Case LCase(OPTION_QUERY)
  624. If intQCount = 1 Then ' intQCount = 1 means help specified
  625. intParseCmdLine = CONST_SHOW_USAGE
  626. Else
  627. intParseCmdLine = CONST_QUERY_OPTION
  628. End If
  629. intMainOption = CONST_QUERY_OPTION
  630. intMainOptionNumber = intMainOptionNumber + 1
  631. intArgIter = intArgIter + 1
  632. Case LCase(SUB_OPTION_SERVER)
  633. ' Check if server name is given with help usage
  634. If intParseCmdLine = CONST_SHOW_USAGE Then
  635. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  636. WScript.Quit(EXIT_INVALID_INPUT)
  637. End If
  638. ' Check if Machine Name is already specified
  639. If NOT blnMachineSpecified Then
  640. blnMachineSpecified = TRUE ' Set Specified Flag to TRUE
  641. If NOT component.getArguments(L_MachineName_Text,strMachine,intArgIter,FALSE) Then
  642. component.VBPrintf L_InvalidSyntax_ErrorMessage
  643. Call typeMessage(intMainOption)
  644. intParseCmdLine = CONST_ERROR
  645. Exit Function
  646. End If
  647. intArgIter = intArgIter + 1
  648. Else
  649. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  650. L_NotAllowedMoreThanOnce_ErrorMessage , _
  651. Array(WScript.Arguments.Item(intArgIter))
  652. ' print the appropriate help usage message
  653. Call typeMessage(intMainOption)
  654. WScript.Quit(EXIT_INVALID_INPUT)
  655. End If
  656. Case LCase(SUB_OPTION_USER)
  657. ' Check if user name is given with help usage
  658. If intParseCmdLine = CONST_SHOW_USAGE Then
  659. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  660. WScript.Quit(EXIT_INVALID_INPUT)
  661. End If
  662. ' Check if User Name is already specified
  663. If NOT blnUserSpecified Then
  664. blnUserSpecified = TRUE ' Set Specified Flag to TRUE
  665. If NOT component.getArguments(L_User_Text,strUserName,intArgIter,FALSE) Then
  666. component.VBPrintf L_InvalidSyntax_ErrorMessage
  667. Call typeMessage(intMainOption)
  668. intParseCmdLine = CONST_ERROR
  669. Exit Function
  670. End If
  671. intArgIter = intArgIter + 1
  672. Else
  673. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  674. L_NotAllowedMoreThanOnce_ErrorMessage , _
  675. Array(WScript.Arguments.Item(intArgIter))
  676. ' print the appropriate help usage message
  677. Call typeMessage(intMainOption)
  678. WScript.Quit(EXIT_INVALID_INPUT)
  679. End If
  680. Case LCase(SUB_OPTION_PASSWORD)
  681. ' Check if password is given with help usage
  682. If intParseCmdLine = CONST_SHOW_USAGE Then
  683. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  684. WScript.Quit(EXIT_INVALID_INPUT)
  685. End If
  686. ' Check if Password is already specified
  687. If NOT blnPasswordSpecified Then
  688. blnPasswordSpecified = TRUE ' Set Specified Flag to TRUE
  689. If NOT component.getArguments(L_Password_Text,strPassword,intArgIter,FALSE) Then
  690. component.VBPrintf L_InvalidSyntax_ErrorMessage
  691. Call typeMessage(intMainOption)
  692. intParseCmdLine = CONST_ERROR
  693. Exit Function
  694. End If
  695. intArgIter = intArgIter + 1
  696. Else
  697. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  698. L_NotAllowedMoreThanOnce_ErrorMessage , _
  699. Array(WScript.Arguments.Item(intArgIter))
  700. ' print the appropriate help usage message
  701. Call typeMessage(intMainOption)
  702. WScript.Quit(EXIT_INVALID_INPUT)
  703. End If
  704. Case LCase(SUB_OPTION_INTSIZE)
  705. ' Check if initsize is given with help usage
  706. If intParseCmdLine = CONST_SHOW_USAGE Then
  707. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  708. WScript.Quit(EXIT_INVALID_INPUT)
  709. End If
  710. ' Check if initsize is already specified
  711. If NOT blnIntSizeSpecified Then
  712. blnIntSizeSpecified = TRUE ' Set Specified Flag to TRUE
  713. If NOT component.getArguments(L_Intsize_Text,intIntSize,intArgIter,FALSE) Then
  714. component.VBPrintf L_InvalidSyntax_ErrorMessage
  715. Call typeMessage(intMainOption)
  716. intParseCmdLine = CONST_ERROR
  717. Exit Function
  718. End If
  719. blnInitSize = TRUE
  720. intArgIter = intArgIter + 1
  721. Else
  722. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  723. L_NotAllowedMoreThanOnce_ErrorMessage , _
  724. Array(WScript.Arguments.Item(intArgIter))
  725. ' print the appropriate help usage message
  726. Call typeMessage(intMainOption)
  727. WScript.Quit(EXIT_INVALID_INPUT)
  728. End If
  729. Case LCase(SUB_OPTION_MAXSIZE)
  730. ' Check if maxsize is given with help usage
  731. If intParseCmdLine = CONST_SHOW_USAGE Then
  732. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  733. WScript.Quit(EXIT_INVALID_INPUT)
  734. End If
  735. ' Check if Maxsize is already specified
  736. If NOT blnMaxSizeSpecified Then
  737. blnMaxSizeSpecified = TRUE ' Set Specified Flag to TRUE
  738. If NOT component.getArguments(L_Maxsize_Text,intMaxSize,intArgIter,FALSE) Then
  739. component.VBPrintf L_InvalidSyntax_ErrorMessage
  740. Call typeMessage(intMainOption)
  741. intParseCmdLine = CONST_ERROR
  742. Exit Function
  743. End If
  744. blnMaxSize = TRUE
  745. intArgIter = intArgIter + 1
  746. Else
  747. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  748. L_NotAllowedMoreThanOnce_ErrorMessage , _
  749. Array(WScript.Arguments.Item(intArgIter))
  750. ' print the appropriate help usage message
  751. Call typeMessage(intMainOption)
  752. WScript.Quit(EXIT_INVALID_INPUT)
  753. End If
  754. Case LCase(SUB_OPTION_FORMAT)
  755. ' Check if maxsize is given with help usage
  756. If intParseCmdLine = CONST_SHOW_USAGE Then
  757. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  758. WScript.Quit(EXIT_INVALID_INPUT)
  759. End If
  760. ' Check if format is already specified
  761. If NOT blnFormatSpecified Then
  762. blnFormatSpecified = TRUE ' Set Specified Flag to TRUE
  763. If NOT component.getArguments(L_Format_Text,strFormat,intArgIter,FALSE) Then
  764. component.VBPrintf L_InvalidSyntax_ErrorMessage
  765. Call typeMessage(intMainOption)
  766. intParseCmdLine = CONST_ERROR
  767. Exit Function
  768. End If
  769. intArgIter = intArgIter + 1
  770. Else
  771. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  772. L_NotAllowedMoreThanOnce_ErrorMessage , _
  773. Array(WScript.Arguments.Item(intArgIter))
  774. ' print the appropriate help usage message
  775. Call typeMessage(intMainOption)
  776. WScript.Quit(EXIT_INVALID_INPUT)
  777. End If
  778. Case LCase(SUB_OPTION_NOHEADER)
  779. ' Check if -nh is already specified
  780. If NOT blnNoHeader Then
  781. blnNoHeader = TRUE
  782. intArgIter = intArgIter + 1
  783. Else
  784. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  785. L_NotAllowedMoreThanOnce_ErrorMessage , _
  786. Array(WScript.Arguments.Item(intArgIter))
  787. ' print the appropriate help usage message
  788. Call typeMessage(intMainOption)
  789. WScript.Quit(EXIT_INVALID_INPUT)
  790. End If
  791. Case Lcase(SUB_OPTION_SYSTEM_MANAGED)
  792. ' Check if -sm is specified
  793. If Not blnSystemManaged Then
  794. blnSystemManaged = TRUE
  795. intArgIter = intArgIter + 1
  796. Else
  797. component.VBPrintf L_InvalidSyntax_ErrorMessage & " " & _
  798. L_NotAllowedMoreThanOnce_ErrorMessage, _
  799. Array(Wscript.Arguments.Item(intArgIter))
  800. ' Print the corresponding help usage error message
  801. Call typeMessage(intMainOption)
  802. Wscript.Quit(EXIT_INVALID_INPUT)
  803. End If
  804. Case LCase(SUB_OPTION_VOLUME)
  805. ' Check if volume is given with help usage
  806. If intParseCmdLine = CONST_SHOW_USAGE Then
  807. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  808. WScript.Quit(EXIT_INVALID_INPUT)
  809. End If
  810. If NOT component.getArguments(L_Volume_Text,strVolName,intArgIter,FALSE) Then
  811. component.VBPrintf L_InvalidSyntax_ErrorMessage
  812. Call typeMessage(intMainOption)
  813. intParseCmdLine = CONST_ERROR
  814. Exit Function
  815. Else
  816. If strVolName = "*" Then
  817. objVols.Add LCase(strVolName), -1
  818. Else
  819. If NOT objVols.Exists(LCase(strVolName)) Then
  820. objVols.Add LCase(strVolName), -1
  821. End If
  822. intVolumes = objVols.Count
  823. End If
  824. End If
  825. intArgIter = intArgIter + 1
  826. Case Else
  827. ' display the invalid param err msg first
  828. component.VBPrintf L_InvalidParameter_ErrorMessage, _
  829. Array(WScript.arguments.Item(intArgIter))
  830. ' then display the 'type ..usage' message
  831. Select Case CInt(intMainOption)
  832. Case CONST_CHANGE_OPTION
  833. component.VBPrintf L_TypeChangeUsage_Message, _
  834. Array(UCase(WScript.ScriptName))
  835. WScript.Quit(EXIT_INVALID_PARAM)
  836. Case CONST_CREATE_OPTION
  837. component.VBPrintf L_TypeCreateUsage_Message, _
  838. Array(UCase(WScript.ScriptName))
  839. WScript.Quit(EXIT_INVALID_PARAM)
  840. Case CONST_DELETE_OPTION
  841. component.VBPrintf L_TypeDeleteUsage_Message, _
  842. Array(UCase(WScript.ScriptName))
  843. WScript.Quit(EXIT_INVALID_PARAM)
  844. Case CONST_QUERY_OPTION
  845. component.VBPrintf L_TypeQueryUsage_Message, _
  846. Array(UCase(WScript.ScriptName))
  847. WScript.Quit(EXIT_INVALID_PARAM)
  848. Case Else
  849. component.VBPrintf L_TypeUsage_Message, _
  850. Array(UCase(WScript.ScriptName))
  851. WScript.Quit(EXIT_INVALID_PARAM)
  852. End Select
  853. End Select
  854. Else
  855. ' invalid argument specified
  856. ' display the invalid param err msg first
  857. component.VBPrintf L_InvalidParameter_ErrorMessage, _
  858. Array(WScript.arguments.Item(intArgIter))
  859. ' then display the 'type ..usage' message
  860. Select Case CInt(intMainOption)
  861. Case CONST_CHANGE_OPTION
  862. component.VBPrintf L_TypeChangeUsage_Message, _
  863. Array(UCase(WScript.ScriptName))
  864. WScript.Quit(EXIT_INVALID_PARAM)
  865. Case CONST_CREATE_OPTION
  866. component.VBPrintf L_TypeCreateUsage_Message, _
  867. Array(UCase(WScript.ScriptName))
  868. WScript.Quit(EXIT_INVALID_PARAM)
  869. Case CONST_DELETE_OPTION
  870. component.VBPrintf L_TypeDeleteUsage_Message, _
  871. Array(UCase(WScript.ScriptName))
  872. WScript.Quit(EXIT_INVALID_PARAM)
  873. Case CONST_QUERY_OPTION
  874. component.VBPrintf L_TypeQueryUsage_Message, _
  875. Array(UCase(WScript.ScriptName))
  876. WScript.Quit(EXIT_INVALID_PARAM)
  877. Case Else
  878. component.VBPrintf L_TypeUsage_Message, _
  879. Array(UCase(WScript.ScriptName))
  880. WScript.Quit(EXIT_INVALID_PARAM)
  881. End Select
  882. End If
  883. Loop
  884. ' check if the there is any volume(s) specified.
  885. If objVols.Count = 0 Then
  886. intVolumes = objVols.Count
  887. End If
  888. ' Check if volumes | * is specified along with help
  889. If (intVolumes > 0 AND intQCount = 1) Then
  890. WScript.Echo(L_InvalidHelpUsage_ErrorMessage)
  891. WScript.Quit(EXIT_INVALID_INPUT)
  892. End If
  893. ' Check if two major operations are selected at a time
  894. If ( intMainOptionNumber > 1 ) Then
  895. WScript.Echo(L_InvalidSyntax_ErrorMessage)
  896. component.VBPrintf L_TypeUsage_Message,Array(UCase(WScript.ScriptName))
  897. WScript.Quit(EXIT_INVALID_INPUT)
  898. ElseIf (intQcount = 0 AND intmainoption = 0) Then
  899. intMainOption = CONST_QUERY_OPTION
  900. End If
  901. ' check if NO major option(s) is specified, but other switches are specified
  902. If ( intMainOptionNumber = 0 ) Then
  903. If blnIntSizeSpecified OR _
  904. blnMaxSizeSpecified OR _
  905. blnFormatSpecified OR _
  906. blnMachineSpecified OR _
  907. blnUserSpecified OR _
  908. blnPasswordSpecified OR _
  909. blnNoHeader OR _
  910. intVolumes > 0 Then
  911. WScript.Echo(L_InvalidSyntax_ErrorMessage)
  912. component.VBPrintf L_TypeUsage_Message, _
  913. Array(UCase(WScript.ScriptName))
  914. WScript.Quit(EXIT_INVALID_INPUT)
  915. End If
  916. End If
  917. ' check if format is specified with create option
  918. If (intMainOption = CONST_CREATE_OPTION) Then
  919. If blnFormatSpecified Then
  920. WScript.Echo(L_InvalidSyntax_ErrorMessage)
  921. component.VBPrintf L_TypeCreateUsage_Message, _
  922. Array(UCase(WScript.ScriptName))
  923. WScript.Quit(EXIT_INVALID_INPUT)
  924. End If
  925. End If
  926. ' check if format is specified with change option
  927. If (intMainOption = CONST_CHANGE_OPTION) Then
  928. If blnFormatSpecified Then
  929. WScript.Echo(L_InvalidSyntax_ErrorMessage)
  930. component.VBPrintf L_TypeChangeUsage_Message, _
  931. Array(UCase(WScript.ScriptName))
  932. WScript.Quit(EXIT_INVALID_INPUT)
  933. End If
  934. End If
  935. ' check if /Initsize, /Maxsize, /FO are specified
  936. If (intMainOption = CONST_DELETE_OPTION) Then
  937. If (blnIntSizeSpecified OR blnMaxSizeSpecified OR blnFormatSpecified OR blnSystemManaged) Then
  938. WScript.Echo(L_InvalidSyntax_ErrorMessage)
  939. component.VBPrintf L_TypeDeleteUsage_Message, _
  940. Array(UCase(WScript.ScriptName))
  941. WScript.Quit(EXIT_INVALID_INPUT)
  942. End If
  943. End If
  944. ' check if /Initsize, /Maxsize, are specified
  945. If (intMainOption = CONST_QUERY_OPTION) Then
  946. If (blnIntSizeSpecified OR blnMaxSizeSpecified OR blnSystemManaged) Then
  947. WScript.Echo(L_InvalidSyntax_ErrorMessage)
  948. component.VBPrintf L_TypeQueryUsage_Message, _
  949. Array(UCase(WScript.ScriptName))
  950. WScript.Quit(EXIT_INVALID_INPUT)
  951. End If
  952. End If
  953. End Function
  954. '******************************************************************************
  955. '* Function: ValidateArguments
  956. '*
  957. '* Purpose: Validates the command line arguments given by the user
  958. '*
  959. '* Input:
  960. '* [out] strMachine machine to configure page files on
  961. '* [out] strUserName user name to connect to the machine
  962. '* [out] strPassword password for the user
  963. '* [out] intIntSize the initial size for the page file
  964. '* [out] intMaxSize the maximum size for the page file
  965. '* [out] objVols the object containing volume names
  966. '* [out] strFormat the query display format
  967. '* [out] blnNoHeader the query display format
  968. '* [out] intMainOption the main option specified
  969. '*
  970. '* Output: Returns true if all valid else displays error message and quits
  971. '* Gets the password from the user if not specified along with User.
  972. '*
  973. '******************************************************************************
  974. Private Function ValidateArguments ( ByRef strMachine, _
  975. ByRef strUserName, _
  976. ByRef strPassword, _
  977. ByRef intIntSize, _
  978. ByRef intMaxSize, _
  979. ByRef objVols, _
  980. ByRef strFormat, _
  981. ByRef blnNoHeader, _
  982. ByRef blnSystemManaged, _
  983. ByRef blnInitSize, _
  984. ByRef blnMaxSize, _
  985. ByRef intMainOption)
  986. ON ERROR RESUME NEXT
  987. Err.Clear
  988. Dim strMatchPattern ' the pattern to be matched
  989. Dim intVolumes ' to count the no.of volumes specified
  990. Dim arrVolume ' array to store the volumes specified
  991. Dim i ' Loop variable
  992. ' Initialization
  993. intVolumes = CInt(objVols.Count)
  994. arrVolume = objVols.Keys
  995. ValidateArguments = TRUE
  996. i = 0
  997. ' Check if invalid server name is given
  998. If NOT IsEmpty(strMachine) Then
  999. If Trim(strMachine) = vbNullString Then
  1000. WScript.Echo(L_InvalidServerName_ErrorMessage)
  1001. WScript.Quit(EXIT_INVALID_INPUT)
  1002. End If
  1003. End If
  1004. ' Check if invalid user name is given
  1005. If NOT IsEmpty(strUserName) Then
  1006. If Trim(strUserName) = vbNullString Then
  1007. WScript.Echo(L_InvalidUserName_ErrorMessage)
  1008. WScript.Quit(EXIT_INVALID_INPUT)
  1009. End If
  1010. End If
  1011. ' check if user is given without machine OR password
  1012. If ((strUserName <> VBEmpty) AND (strMachine = VBEmpty)) Then
  1013. WScript.Echo L_InvalidServerCredentials_ErrorMessage
  1014. component.VBPrintf L_TypeUsage_Message, _
  1015. Array(UCase(WScript.ScriptName))
  1016. WScript.Quit(EXIT_INVALID_INPUT)
  1017. ' check if password is given without user OR machine
  1018. ElseIf ((strPassword <> VBEmpty) AND (strUserName = VBEmpty))Then
  1019. WScript.Echo L_InvalidUserCredentials_ErrorMessage
  1020. component.VBPrintf L_TypeUsage_Message, _
  1021. Array(UCase(WScript.ScriptName))
  1022. WScript.Quit(EXIT_INVALID_INPUT)
  1023. End If
  1024. ' Check if initial size is specified, validate if it is a poistive number
  1025. If Len(CStr(intIntSize)) > 0 Then
  1026. ' Initsize should be numeric only
  1027. ' chr(46) indicates "." (dot)
  1028. If NOT (IsNumeric(intIntSize) AND InStr(intIntSize,chr(46)) = 0 AND Instr(intIntSize,"-") = 0) Then
  1029. ValidateArguments = FALSE
  1030. WScript.Echo L_InvalidInitSizeValue_ErrorMessage
  1031. WScript.Quit(EXIT_INVALID_INPUT)
  1032. End If
  1033. End If
  1034. ' Check if maximum size is specified, validate if it is a poistive number
  1035. If Len(CStr(intMaxSize)) > 0 Then
  1036. ' Maxsize should be numeric only
  1037. ' chr(46) indicates "." (dot)
  1038. If NOT (IsNumeric(intMaxSize) AND InStr(intMaxSize,chr(46)) = 0 AND Instr(intMaxSize,"-") = 0) Then
  1039. ValidateArguments = FALSE
  1040. WScript.Echo L_InvalidMaxSizeValue_ErrorMessage
  1041. WScript.Quit(EXIT_INVALID_INPUT)
  1042. End If
  1043. End If
  1044. Select Case CInt(intMainOption)
  1045. Case CONST_CHANGE_OPTION
  1046. ' Valid Cases : either (initsize + volume) OR (maxsize + volume)
  1047. ' OR (initsize + maxsize + volume)
  1048. ' If none of the parameters (initsize or maxsize) is specified
  1049. If blnSystemManaged = FALSE Then
  1050. If ( blnInitSize = FALSE AND blnMaxSize = FALSE ) Then
  1051. ValidateArguments = FALSE
  1052. WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1053. L_NoneoftheSizeSpecified_ErrorMessage)
  1054. component.VBPrintf L_TypeChangeUsage_Message, _
  1055. Array(UCase(WScript.ScriptName))
  1056. WScript.Quit(EXIT_INVALID_INPUT)
  1057. End If
  1058. If (blnInitSize = TRUE AND Len(CStr(intIntSize)) = 0 ) Then
  1059. ValidateArguments = FALSE
  1060. Wscript.Echo(L_InvalidInput_ErrorMessage)
  1061. WScript.Quit(EXIT_INVALID_INPUT)
  1062. End If
  1063. If (blnMaxSize = TRUE AND Len(CStr(intMaxSize)) = 0 ) Then
  1064. ValidateArguments = FALSE
  1065. Wscript.Echo(L_InvalidInput_ErrorMessage)
  1066. WScript.Quit(EXIT_INVALID_INPUT)
  1067. End If
  1068. Else
  1069. If (blnInitSize = TRUE OR blnMaxSize = TRUE) Then
  1070. ValidateArguments = FALSE
  1071. Wscript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1072. L_CONST_NoneoftheSizes_AllowedWithSysManaged_Text)
  1073. component.VBPrintf L_TypeChangeUsage_Message, _
  1074. Array(Ucase(Wscript.ScriptName))
  1075. Wscript.Quit(EXIT_INVALID_INPUT)
  1076. End If
  1077. End If
  1078. ' check if the volume is specified
  1079. If (objVols.Count = 0) Then
  1080. ValidateArguments = FALSE
  1081. WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1082. L_VolumeNameNotSpecified_ErrorMessage)
  1083. component.VBPrintf L_TypeChangeUsage_Message, _
  1084. Array(UCase(WScript.ScriptName))
  1085. WScript.Quit(EXIT_INVALID_INPUT)
  1086. ' check if volume name is valid
  1087. ElseIf isValidDrive(objVols,intMainOption) Then
  1088. ValidateArguments = TRUE
  1089. End If
  1090. Case CONST_CREATE_OPTION
  1091. If blnSystemManaged = FALSE Then
  1092. If ( blnInitSize = FALSE OR blnMaxSize = FALSE ) Then
  1093. ValidateArguments = FALSE
  1094. WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1095. L_InitialSizeNotSpecified_ErrorMessage)
  1096. component.VBPrintf L_TypeCreateUsage_Message, _
  1097. Array(UCase(WScript.ScriptName))
  1098. WScript.Quit(EXIT_INVALID_INPUT)
  1099. End If
  1100. If (blnInitSize = TRUE AND Len(CStr(intIntSize)) = 0 ) Then
  1101. ValidateArguments = FALSE
  1102. Wscript.Echo(L_InvalidInput_ErrorMessage)
  1103. WScript.Quit(EXIT_INVALID_INPUT)
  1104. End If
  1105. If (blnMaxSize = TRUE AND Len(CStr(intMaxSize)) = 0 ) Then
  1106. ValidateArguments = FALSE
  1107. Wscript.Echo(L_InvalidInput_ErrorMessage)
  1108. WScript.Quit(EXIT_INVALID_INPUT)
  1109. End If
  1110. Else
  1111. If (blnInitSize = TRUE OR blnMaxSize = TRUE) Then
  1112. ValidateArguments = FALSE
  1113. Wscript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1114. L_CONST_NoneoftheSizes_AllowedWithSysManaged_Text)
  1115. component.VBPrintf L_TypeCreateUsage_Message, _
  1116. Array(Ucase(Wscript.ScriptName))
  1117. Wscript.Quit(EXIT_INVALID_INPUT)
  1118. End If
  1119. End If
  1120. ' volume name is required
  1121. If (objVols.Count = 0) Then
  1122. ValidateArguments = FALSE
  1123. WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1124. L_VolumeNameNotSpecified_ErrorMessage)
  1125. component.VBPrintf L_TypeCreateUsage_Message, _
  1126. Array(UCase(WScript.ScriptName))
  1127. WScript.Quit(EXIT_INVALID_INPUT)
  1128. ' check if volume name is valid
  1129. ElseIf isValidDrive(objVols,intMainOption) Then
  1130. ValidateArguments = TRUE
  1131. End If
  1132. Case CONST_DELETE_OPTION
  1133. ' ONLY volume is required
  1134. If (objVols.Count = 0) Then
  1135. ValidateArguments = FALSE
  1136. WScript.Echo(L_InvalidSyntax_ErrorMessage & " " & _
  1137. L_VolumeNameNotSpecified_ErrorMessage)
  1138. component.VBPrintf L_TypeDeleteUsage_Message, _
  1139. Array(UCase(WScript.ScriptName))
  1140. WScript.Quit(EXIT_INVALID_INPUT)
  1141. ' check if volume name is valid
  1142. ElseIf isValidDrive(objVols,intMainOption) Then
  1143. ValidateArguments = TRUE
  1144. End If
  1145. ' Wild Card Character * is not allowed for /Delete option
  1146. If (objVols.Exists("*")) Then
  1147. ValidateArguments = FALSE
  1148. objVols.Remove "*"
  1149. WScript.Echo(L_InvalidInput_ErrorMessage)
  1150. WScript.Quit(EXIT_INVALID_INPUT)
  1151. End If
  1152. Case CONST_QUERY_OPTION
  1153. ' check if any format is specified.
  1154. If Len(strFormat) > 0 Then
  1155. ' only table, list and csv display formats allowed
  1156. ' PatternFormat_Text contains ^(table|list|csv)$
  1157. If CInt(component.matchPattern(PatternFormat_Text, strFormat)) = CONST_NO_MATCHES_FOUND Then
  1158. component.vbPrintf L_InvalidSyntax_ErrorMessage & " " & _
  1159. L_InvalidFormat_ErrorMessage, Array(strFormat)
  1160. component.VBPrintf L_TypeQueryUsage_Message, _
  1161. Array(UCase(WScript.ScriptName))
  1162. WScript.Quit(EXIT_INVALID_INPUT)
  1163. End If
  1164. End If
  1165. ' Check if -nh is specified for LIST format
  1166. If (blnNoHeader) AND LCase(strFormat) = LCase(ListFormat_Text) then
  1167. WScript.Echo (L_NoHeaderNotAllowed_ErrorMessage)
  1168. WScript.Quit(EXIT_INVALID_INPUT)
  1169. End If
  1170. ' Validation to check if volume names are specified with Query Option:
  1171. If (intVolumes <> 0) Then
  1172. ValidateArguments = FALSE
  1173. WScript.Echo(L_InvalidSyntax_ErrorMessage)
  1174. component.VBPrintf L_TypeQueryUsage_Message, _
  1175. Array(UCase(WScript.ScriptName))
  1176. WScript.Quit(EXIT_INVALID_INPUT)
  1177. End If
  1178. Case Else
  1179. ' if intMainOption has some non-zero value means one operation is selected
  1180. If (intMainOption > 0) Then
  1181. ' -operation & volname together are valid
  1182. ValidateArguments = TRUE
  1183. Else
  1184. ValidateArguments = FALSE
  1185. WScript.Echo(L_InvalidInput_ErrorMessage)
  1186. WScript.Quit(EXIT_INVALID_INPUT)
  1187. End If
  1188. End Select
  1189. ' verify If required credentials given
  1190. If (((NOT IsEmpty(strUserName)) AND (IsEmpty(strMachine))) OR _
  1191. ((NOT IsEmpty(strPassword)) AND (IsEmpty(strUserName))) )Then
  1192. ValidateArguments = FALSE
  1193. WScript.Echo (L_InvalidCredentials_ErrorMessage)
  1194. WScript.Quit(EXIT_INVALID_INPUT)
  1195. End If
  1196. ' check if the machine name is specified using "\\" (UNC format)
  1197. If Left(strMachine,2) = UNC_FORMAT_SERVERNAME_PREFIX Then
  1198. If Len(strMachine) = 2 Then
  1199. WScript.Echo L_InvalidInput_ErrorMessage
  1200. WScript.Quit(EXIT_UNEXPECTED)
  1201. End If
  1202. ' remove the "\\" from the front
  1203. strMachine = Mid(strMachine,3,Len(strMachine))
  1204. End If
  1205. ' If password not specified with the user name, Then get it using cmdlib.wsc function
  1206. If ((NOT IsEmpty(strUserName)) AND (IsEmpty(strPassword)) OR strPassword = "*") Then
  1207. strPassword = component.getPassword()
  1208. End If
  1209. End Function
  1210. '******************************************************************************
  1211. '* Function: isValidDrive
  1212. '*
  1213. '* Purpose: To check if the specified volume is valid or not
  1214. '*
  1215. '* Input:
  1216. '* [in] objVols object that store the volumes specified
  1217. '* [in] intMainOption the main option specified
  1218. '*
  1219. '* Output: Returns TRUE or FALSE
  1220. '*
  1221. '******************************************************************************
  1222. Function isValidDrive(ByRef objVols,ByVal intMainOption)
  1223. ON ERROR RESUME NEXT
  1224. Err.Clear
  1225. Dim intVolumes ' to count the no.of volumes specified
  1226. Dim arrVolume ' array to store the volumes specified
  1227. Dim i ' Loop variable
  1228. ' Initialization
  1229. intVolumes = CInt(objVols.Count)
  1230. arrVolume = objVols.Keys
  1231. isValidDrive = FALSE
  1232. i = 0
  1233. ' Check if the drive name is in correct Format [c-z]: or [C-Z]:
  1234. ' This has to be checked for each Drive specified - Do While Loop
  1235. Do While (i < intVolumes)
  1236. ' Volumes specified are valid for all option except Query
  1237. If intMainOption <> CONST_QUERY_OPTION Then
  1238. ' Valid volume is either '*' OR a letter followed by a colon (total length = 2)
  1239. If ((Len(arrVolume(i)) = 2) AND (InStr(arrVolume(i),chr(58)) = 2) OR arrVolume(i) = "*") Then
  1240. ' check if the volume name specified is in the format ^([c-zC-Z]:|\*)$
  1241. If CInt(component.matchPattern(L_VolumePatternFormat_Text,arrVolume(i))) = CONST_NO_MATCHES_FOUND Then
  1242. ' Invalid Volume Names or junk data is specified
  1243. component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  1244. Array(arrVolume(i))
  1245. isValidDrive = FALSE
  1246. ' remove the INVALID drive(s)
  1247. objVols.Remove arrVolume(i)
  1248. End If
  1249. Else
  1250. isValidDrive = FALSE
  1251. component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  1252. Array(arrVolume(i))
  1253. objVols.Remove arrVolume(i)
  1254. End If
  1255. ' check the number of valid drives specified
  1256. If objVols.Count = 0 Then
  1257. WScript.Quit(EXIT_INVALID_INPUT)
  1258. End If
  1259. Else
  1260. WScript.Echo(L_InvalidInput_ErrorMessage)
  1261. WScript.Quit (EXIT_INVALID_INPUT)
  1262. End If
  1263. isValidDrive = isValidDrive OR TRUE
  1264. i = i + 1
  1265. Loop
  1266. End Function
  1267. '******************************************************************************
  1268. '* Sub: ProcessChange
  1269. '*
  1270. '* Purpose: Processes the /Change option and displays the changed
  1271. '* details of the page file
  1272. '*
  1273. '* Input:
  1274. '* [in] strMachine machine to configure page files on
  1275. '* [in] strUserName user name to connect to the machine
  1276. '* [in] strPassword password for the user
  1277. '* [in] intIntSize the initial size for the page file
  1278. '* [in] intMaxSize the maximum size for the page file
  1279. '* [in] objVols the object containing volume names
  1280. '*
  1281. '* Output: Displays error message and quits if connection fails
  1282. '*
  1283. '******************************************************************************
  1284. Private Sub ProcessChange( ByVal strMachine, _
  1285. ByVal strUserName, _
  1286. ByVal strPassword, _
  1287. ByVal intIntSize, _
  1288. ByVal intMaxSize, _
  1289. ByVal blnSystemManaged, _
  1290. ByVal objVols )
  1291. ON ERROR RESUME NEXT
  1292. Err.Clear
  1293. Dim intOldInitialSize ' to store the old intial size
  1294. Dim intOldMaximumSize ' to store the old maximum size
  1295. Dim arrVolume ' to store all the volumes specified
  1296. Dim intVolumes ' to store the no.of volumes specified
  1297. Dim strQuery ' to store the query for pagefiles
  1298. Dim strQueryDisk ' to store the query for disk
  1299. Dim strQueryComp ' to store the query for computersystem
  1300. Dim objService ' service object
  1301. Dim objInstance ' instance object
  1302. Dim objInst ' instance object
  1303. Dim objEnumerator ' collection set for query results
  1304. Dim objEnumforDisk ' collection set for query results
  1305. Dim objEnum ' collection set for query results
  1306. Dim blnBothSpecified ' flag to check if both initsize & maxsize are specified
  1307. Dim intFreeSpace ' to store total free space
  1308. Dim intFreeDiskSpace ' to store free disk space
  1309. Dim intCurrentSize ' to store the current pagefile size
  1310. Dim intDiskSize ' to store the disk size for the specified disk
  1311. Dim intMemSize ' to store physical memory size
  1312. Dim intCrashDump ' to store the current crash dump setting value
  1313. Dim strReply ' to store the user reply
  1314. Dim strDriveName ' to store the drive name
  1315. Dim strHostName ' to store the host name
  1316. Dim intMaxSizeUB ' to store the upper bound for maximum size
  1317. Dim i ' loop variable
  1318. ' Establish a connection with the server.
  1319. If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  1320. strUserName , _
  1321. strPassword , _
  1322. strMachine , _
  1323. blnLocalConnection, _
  1324. objService ) Then
  1325. WScript.Echo(L_HintCheckConnection_Message)
  1326. WScript.Quit(EXIT_METHOD_FAIL)
  1327. End If
  1328. ' Initialize variables
  1329. i = 0
  1330. intFreeSpace = 0
  1331. intFreeDiskSpace = 0
  1332. intCurrentSize = 0
  1333. blnBothSpecified = FALSE
  1334. intMaxSizeUB = 0
  1335. strQuery = "Select * From " & CLASS_PAGE_FILE_SETTING
  1336. If (objVols.Exists("*")) Then
  1337. Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  1338. For each objInstance in objEnumerator
  1339. strDriveName = Mid(objInstance.Name,1,2)
  1340. If NOT objVols.Exists (LCase(strDriveName)) Then
  1341. objVols.add LCase(strDriveName), -1
  1342. End If
  1343. Next
  1344. objVols.remove "*"
  1345. End If
  1346. intVolumes = objVols.Count
  1347. arrVolume = objVols.keys
  1348. ' get the host Name - used to get Crash Dump Settings
  1349. strQueryComp = "Select * From " & CLASS_COMPUTER_SYSTEM
  1350. Set objEnum = objService.ExecQuery(strQueryComp, "WQL", 0, null)
  1351. ' check for any errors
  1352. If Err.Number Then
  1353. Err.Clear
  1354. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1355. WScript.Quit(EXIT_QUERY_FAIL)
  1356. End If
  1357. For each objInst in objEnum
  1358. If NOT ISEmpty(objInst.Name) Then
  1359. strHostName = objInst.Name
  1360. Else
  1361. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1362. WScript.Quit(EXIT_QUERY_FAIL)
  1363. End If
  1364. Next
  1365. ' check if initsize and maxsize both are specified
  1366. If (Len(intIntSize) > 0 AND Len(intMaxSize) > 0) Then
  1367. blnBothSpecified = TRUE
  1368. End If
  1369. ' check if no page files exist on the system.
  1370. strQuery = "Select * From " & CLASS_PAGE_FILE_SETTING
  1371. Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  1372. If (objEnumerator.Count = 0) Then
  1373. WScript.Echo(L_NoPageFiles_Message)
  1374. WScript.Quit(EXIT_UNEXPECTED)
  1375. End If
  1376. ' release the object for re-use.
  1377. Set objEnumerator = nothing
  1378. Do While( i < intVolumes )
  1379. ' check if its a valid drive/volume - check from Win32_LogicalDisk
  1380. strQueryDisk = "Select * From " & CLASS_LOGICAL_DISK & _
  1381. " where DriveType = " & DRIVE_TYPE & " and DeviceID = '" & arrVolume(i) & "'"
  1382. Set objEnumforDisk = objService.ExecQuery(strQueryDisk, "WQL", 0, null)
  1383. If objEnumforDisk.Count > 0 Then
  1384. strQuery = "Select * From " & CLASS_PAGE_FILE_SETTING
  1385. strQuery = strQuery & " where NAME = '" & arrVolume(i) & _
  1386. "\" & PAGEFILE_DOT_SYS & "'"
  1387. Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  1388. ' check for any errors
  1389. If Err.Number Then
  1390. Err.Clear
  1391. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1392. blnFailureMsg = TRUE
  1393. quitbasedonsuccess EXIT_QUERY_FAIL
  1394. End If
  1395. ' check if a page file exists on the specified volume
  1396. If (objEnumerator.Count > 0) Then
  1397. For each objInstance in objEnumerator
  1398. If blnSystemManaged = TRUE Then
  1399. If( objInstance.InitialSize = 0 AND objInstance.MaximumSize = 0 ) Then
  1400. Component.VBPrintf L_CONST_Already_SystemManaged_Text, Array(Ucase(arrVolume(i)))
  1401. blnFailureMsg = TRUE
  1402. Exit For
  1403. End If
  1404. objInstance.InitialSize = CONST_SYSTEM_INIT_SIZE
  1405. objInstance.MaximumSize = CONST_SYSTEM_MAX_SIZE
  1406. objInstance.Put_(CONST_WBEM_FLAG)
  1407. If Err.Number Then
  1408. Err.Clear
  1409. Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  1410. blnFailureMsg = TRUE
  1411. quitbasedonsuccess EXIT_INVALID_INPUT
  1412. End If
  1413. component.VBPrintf L_ChangeSystemSuccess_message, _
  1414. Array(UCase(arrVolume(i)))
  1415. blnSuccessMsg = TRUE
  1416. Exit For
  1417. Else
  1418. strDriveName = Mid(objInstance.Name,1,2)
  1419. 'If the page file was system managed, then, the user has to specify both
  1420. 'initial and maximum sizes..
  1421. If (objInstance.InitialSize =0 AND objInstance.MaximumSize = 0 ) Then
  1422. If Not blnBothSpecified Then
  1423. component.VBPrintf L_CONST_Systemmanaged_Earlier_Text, Array(Ucase( arrVolume(i)))
  1424. blnFailureMsg = TRUE
  1425. Exit For
  1426. End If
  1427. End If
  1428. If NOT blnBothSpecified Then
  1429. ' check if initsize is given
  1430. If (intIntSize > 0) Then
  1431. ' Check if initsize is greater than 2 MB
  1432. If CLng(intIntSize) >= CLng(INITIAL_SIZE_LB) Then
  1433. ' check for overflows
  1434. If Err.Number Then
  1435. Err.Clear
  1436. ' get the upper bound allowed for maximum size
  1437. intMaxSizeUB = getMaxSizeUB(objService)
  1438. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1439. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1440. blnFailureMsg = TRUE
  1441. quitbasedonsuccess EXIT_INVALID_INPUT
  1442. End If
  1443. ' get the drive name first
  1444. strDriveName = Mid(objInstance.Name,1,2)
  1445. ' get the free space available on the specified disk
  1446. intFreeDiskSpace = getFreeSpaceOnDisk(strDriveName,objService)
  1447. ' get the current pagefile size
  1448. intCurrentSize = getCurrentPageFileSize(objService,objInstance)
  1449. ' get the total free space
  1450. If Len(intCurrentSize) > 0 Then
  1451. intFreeSpace = intFreeDiskSpace + intCurrentSize
  1452. Else
  1453. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1454. blnFailureMsg = TRUE
  1455. quitbasedonsuccess EXIT_QUERY_FAIL
  1456. End If
  1457. ' Check if it is greater than free disk space
  1458. If CLng(intIntSize) > CLng(intFreeSpace) Then
  1459. ' check for overflows
  1460. If Err.Number Then
  1461. Err.Clear
  1462. ' get the upper bound allowed for maximum size
  1463. intMaxSizeUB = getMaxSizeUB(objService)
  1464. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1465. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1466. blnFailureMsg = TRUE
  1467. quitbasedonsuccess EXIT_INVALID_INPUT
  1468. End If
  1469. component.VBPrintf NotEnoughSpaceErrorMessage, Array( UCase(arrVolume(i)))
  1470. blnFailureMsg = TRUE
  1471. Exit For
  1472. Else
  1473. If CLng(intIntSize) > CLng(intFreeSpace) - 5 Then
  1474. ' check for overflows
  1475. If Err.Number Then
  1476. Err.Clear
  1477. WScript.Echo(L_InvalidInput_ErrorMessage)
  1478. blnFailureMsg = TRUE
  1479. quitbasedonsuccess EXIT_INVALID_INPUT
  1480. End If
  1481. component.VBPrintf AtLeastFiveMBErrorMessage, Array( UCase(arrVolume(i)))
  1482. blnFailureMsg = TRUE
  1483. Exit For
  1484. Else
  1485. ' only one of initsize, maxsize is specified
  1486. ' check if the specified initsize is less than existing maxsize
  1487. If (CInt(intIntSize) <= objInstance.MaximumSize) Then
  1488. ' get the crash dump setting value
  1489. intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  1490. ' get the Physical Memory Size
  1491. intMemSize = GetPhysicalMemorySize(strHostName,objService)
  1492. ' If the user has selected "yes" for the warning message
  1493. If isCrashDumpValueSet(intCrashDump,intIntSize,intMemSize,arrVolume(i)) Then
  1494. ' Check if initsize is same as the present value
  1495. If (CInt(intIntSize) <> objInstance.InitialSize) Then
  1496. ' store the old initsize value
  1497. intOldInitialSize = objInstance.InitialSize
  1498. ' set the new initsize
  1499. objInstance.InitialSize = intIntSize
  1500. objInstance.Put_(CONST_WBEM_FLAG)
  1501. If Err.Number Then
  1502. Err.Clear
  1503. WScript.Echo(L_UpdateFailed_ErrorMessage)
  1504. blnFailureMsg = TRUE
  1505. quitbasedonsuccess EXIT_INVALID_INPUT
  1506. End If
  1507. component.VBPrintf ChangeIntSuccessMessage, _
  1508. Array(UCase(arrVolume(i)),CInt(intOldInitialSize),CInt(intIntSize))
  1509. blnSuccessMsg = TRUE
  1510. Exit For
  1511. Else
  1512. component.VBPrintf ChangeIntSkippingMessage, Array(UCase(arrVolume(i)))
  1513. blnFailureMsg = TRUE
  1514. Exit For
  1515. End If
  1516. ' If User chooses No for CrashDumpSetting prompt
  1517. Else
  1518. ' Do Nothing just continue looping
  1519. Exit For
  1520. End If
  1521. Else
  1522. ' get the upper bound allowed for maximum size
  1523. intMaxSizeUB = getMaxSizeUB(objService)
  1524. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1525. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1526. blnFailureMsg = TRUE
  1527. Exit For
  1528. End If
  1529. End If
  1530. End If
  1531. Else
  1532. ' get the upper bound allowed for maximum size
  1533. intMaxSizeUB = getMaxSizeUB(objService)
  1534. component.VBPrintf InitialSizeRangeErrorMessage, _
  1535. Array(intMaxSizeUB, UCase(arrVolume(i)))
  1536. blnFailureMsg = TRUE
  1537. quitbasedonsuccess EXIT_INVALID_INPUT
  1538. End If
  1539. Else
  1540. ' Check if initsize specified as 0
  1541. If Len(intIntSize) > 0 Then
  1542. ' get the upper bound allowed for maximum size
  1543. intMaxSizeUB = getMaxSizeUB(objService)
  1544. component.VBPrintf InitialSizeRangeErrorMessage, _
  1545. Array(intMaxSizeUB, UCase(arrVolume(i)))
  1546. blnFailureMsg = TRUE
  1547. quitbasedonsuccess EXIT_INVALID_INPUT
  1548. End If
  1549. End If ' initsize checked
  1550. ' check if maxsize is given
  1551. If (intMaxSize > 0) Then
  1552. ' get the free space available on the specified disk
  1553. intFreeDiskSpace = getFreeSpaceOnDisk(strDriveName,objService)
  1554. ' get the current pagefile size
  1555. intCurrentSize = getCurrentPageFileSize(objService,objInstance)
  1556. ' get the total free space
  1557. If Len(intCurrentSize) > 0 Then
  1558. intFreeSpace = intFreeDiskSpace + intCurrentSize
  1559. Else
  1560. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1561. blnFailureMsg = TRUE
  1562. quitbasedonsuccess EXIT_QUERY_FAIL
  1563. End If
  1564. ' Get the Disk Size for the specified drive
  1565. intDiskSize = GetDiskSize(arrVolume(i),objService)
  1566. ' check if maxsize is more than initsize
  1567. If (CLng(intMaxSize) > CLng(intDiskSize)) Then
  1568. ' check for overflows
  1569. If Err.Number Then
  1570. Err.Clear
  1571. ' get the upper bound allowed for maximum size
  1572. intMaxSizeUB = getMaxSizeUB(objService)
  1573. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1574. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1575. blnFailureMsg = TRUE
  1576. quitbasedonsuccess EXIT_INVALID_INPUT
  1577. End If
  1578. component.VBPrintf DiskTooSmallErrorMessage, Array(UCase(arrVolume(i)))
  1579. blnFailureMsg = TRUE
  1580. Exit For
  1581. Else
  1582. If (CLng(intMaxSize) > CLng(intFreeSpace)) Then
  1583. ' check for overflows
  1584. If Err.Number Then
  1585. Err.Clear
  1586. WScript.Echo(L_InvalidInput_ErrorMessage)
  1587. blnFailureMsg = TRUE
  1588. quitbasedonsuccess EXIT_INVALID_INPUT
  1589. End If
  1590. component.VBPrintf GrowsToFreeSpaceWarningMessage, _
  1591. Array(UCase(arrVolume(i)),intFreeSpace)
  1592. strReply = getReply()
  1593. If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  1594. ' set the maxsize to be the free space on disk
  1595. intMaxSize = intFreeSpace
  1596. ' check if the given maxsize is greater than the existing initial size.
  1597. If (CInt(intMaxSize) >= objInstance.InitialSize) Then
  1598. If (CInt(intMaxSize) <> objInstance.MaximumSize) Then
  1599. intOldMaximumSize = objInstance.MaximumSize
  1600. objInstance.MaximumSize = intMaxSize
  1601. objInstance.Put_(CONST_WBEM_FLAG)
  1602. If Err.Number Then
  1603. Err.Clear
  1604. WScript.Echo(L_UpdateFailed_ErrorMessage)
  1605. blnFailureMsg = TRUE
  1606. quitbasedonsuccess EXIT_INVALID_INPUT
  1607. End If
  1608. component.VBPrintf ChangeMaxSuccessMessage, _
  1609. Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  1610. blnSuccessMsg = TRUE
  1611. Exit For
  1612. Else
  1613. component.VBPrintf ChangeMaxSkippingMessage, Array(UCase(arrVolume(i)))
  1614. blnFailureMsg = TRUE
  1615. Exit For
  1616. End If
  1617. Else
  1618. ' get the upper bound allowed for maximum size
  1619. intMaxSizeUB = getMaxSizeUB(objService)
  1620. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1621. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1622. blnFailureMsg = TRUE
  1623. Exit For
  1624. End If
  1625. ElseIf LCase(strReply) = L_UserReplyNo_Text Then
  1626. ' Do Nothing continue with other drives
  1627. Exit For
  1628. Else
  1629. WScript.Echo(L_InvalidInput_ErrorMessage)
  1630. blnFailureMsg = TRUE
  1631. ' Continue looping
  1632. Exit For
  1633. End If
  1634. Else
  1635. If (CInt(intMaxSize) >= objInstance.InitialSize) Then
  1636. If (CInt(intMaxSize) <> objInstance.MaximumSize) Then
  1637. intOldMaximumSize = objInstance.MaximumSize
  1638. objInstance.MaximumSize = intMaxSize
  1639. objInstance.Put_(CONST_WBEM_FLAG)
  1640. If Err.Number Then
  1641. Err.Clear
  1642. WScript.Echo(L_UpdateFailed_ErrorMessage)
  1643. blnFailureMsg = TRUE
  1644. quitbasedonsuccess EXIT_INVALID_INPUT
  1645. End If
  1646. component.VBPrintf ChangeMaxSuccessMessage, _
  1647. Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  1648. blnSuccessMsg = TRUE
  1649. Exit For
  1650. Else
  1651. component.VBPrintf ChangeMaxSkippingMessage, Array(UCase(arrVolume(i)))
  1652. blnFailureMsg = TRUE
  1653. Exit For
  1654. End If
  1655. Else
  1656. ' get the upper bound allowed for maximum size
  1657. intMaxSizeUB = getMaxSizeUB(objService)
  1658. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1659. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1660. blnFailureMsg = TRUE
  1661. Exit For
  1662. End If
  1663. End If
  1664. End If
  1665. Else
  1666. ' Check if maxsize specified as 0
  1667. If Len(intMaxSize) > 0 Then
  1668. ' get the upper bound allowed for maximum size
  1669. intMaxSizeUB = getMaxSizeUB(objService)
  1670. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1671. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1672. blnFailureMsg = TRUE
  1673. Exit For
  1674. End If
  1675. End If ' maxsize checked
  1676. Else
  1677. ' Case when both initsize and maxsize are selected
  1678. ' check if maxsize is greater than initsize
  1679. ' this will detect any overflow problems, if any
  1680. If CLng(intIntSize) > CLng(intMaxSize) Then
  1681. ' check for overflows and clear the error
  1682. If Err.Number Then Err.Clear
  1683. ' get the upper bound allowed for maximum size
  1684. intMaxSizeUB = getMaxSizeUB(objService)
  1685. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1686. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1687. blnFailureMsg = TRUE
  1688. quitbasedonsuccess EXIT_INVALID_INPUT
  1689. End If
  1690. If (intIntSize > 0) Then
  1691. ' Check if initsize is greater than 2 MB
  1692. If CLng(intIntSize) >= CLng(INITIAL_SIZE_LB) Then
  1693. ' check for overflows
  1694. If Err.Number Then
  1695. Err.Clear
  1696. ' get the upper bound allowed for maximum size
  1697. intMaxSizeUB = getMaxSizeUB(objService)
  1698. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1699. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1700. blnFailureMsg = TRUE
  1701. quitbasedonsuccess EXIT_INVALID_INPUT
  1702. End If
  1703. ' get the free space available on the specified disk
  1704. intFreeDiskSpace = getFreeSpaceOnDisk(strDriveName,objService)
  1705. ' get the current pagefile size
  1706. intCurrentSize = getCurrentPageFileSize(objService,objInstance)
  1707. ' get the total free space
  1708. If Len(intCurrentSize) > 0 Then
  1709. intFreeSpace = intFreeDiskSpace + intCurrentSize
  1710. Else
  1711. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1712. blnFailureMsg = TRUE
  1713. quitbasedonsuccess EXIT_QUERY_FAIL
  1714. End If
  1715. ' check if it is greater than free disk space
  1716. If CLng(intIntSize) > CLng(intFreeSpace) Then
  1717. ' check for overflows
  1718. If Err.Number Then
  1719. Err.Clear
  1720. ' get the upper bound allowed for maximum size
  1721. intMaxSizeUB = getMaxSizeUB(objService)
  1722. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1723. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1724. blnFailureMsg = TRUE
  1725. quitbasedonsuccess EXIT_INVALID_INPUT
  1726. End If
  1727. component.VBPrintf NotEnoughSpaceErrorMessage, Array( UCase(arrVolume(i)))
  1728. blnFailureMsg = TRUE
  1729. Exit For
  1730. End If
  1731. If CLng(intIntSize) > CLng(intFreeSpace) - 5 Then
  1732. ' check for overflows
  1733. If Err.Number Then
  1734. Err.Clear
  1735. WScript.Echo(L_InvalidInput_ErrorMessage)
  1736. blnFailureMsg = TRUE
  1737. quitbasedonsuccess EXIT_INVALID_INPUT
  1738. End If
  1739. component.VBPrintf AtLeastFiveMBErrorMessage, Array( UCase(arrVolume(i)))
  1740. blnFailureMsg = TRUE
  1741. Exit For
  1742. Else
  1743. ' get the crash dump setting value
  1744. intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  1745. ' get the Physical Memory Size
  1746. intMemSize = GetPhysicalMemorySize(strHostName,objService)
  1747. ' If the user has selected "yes" for the warning message
  1748. If isCrashDumpValueSet(intCrashDump,intIntSize,intMemSize,arrVolume(i)) Then
  1749. ' store the old initsize value
  1750. intOldInitialSize = objInstance.InitialSize
  1751. ' set the new initsize
  1752. objInstance.InitialSize = intIntSize
  1753. ' check if maxsize is given
  1754. If (intMaxSize > 0) Then
  1755. ' Get the Disk Size for the specified drive
  1756. intDiskSize = GetDiskSize(arrVolume(i),objService)
  1757. ' check if maxsize is more than initsize
  1758. If (CLng(intMaxSize) > CLng(intDiskSize)) Then
  1759. ' check for overflows
  1760. If Err.Number Then
  1761. Err.Clear
  1762. ' get the upper bound allowed for maximum size
  1763. intMaxSizeUB = getMaxSizeUB(objService)
  1764. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1765. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1766. blnFailureMsg = TRUE
  1767. quitbasedonsuccess EXIT_INVALID_INPUT
  1768. End If
  1769. component.VBPrintf DiskTooSmallErrorMessage, _
  1770. Array(UCase(arrVolume(i)))
  1771. blnFailureMsg = TRUE
  1772. Exit For
  1773. Else
  1774. If (CLng(intMaxSize) > CLng(intFreeSpace)) Then
  1775. ' check for overflows
  1776. If Err.Number Then
  1777. Err.Clear
  1778. WScript.Echo(L_InvalidInput_ErrorMessage)
  1779. blnFailureMsg = TRUE
  1780. quitbasedonsuccess EXIT_INVALID_INPUT
  1781. End If
  1782. component.VBPrintf GrowsToFreeSpaceWarningMessage, _
  1783. Array(UCase(arrVolume(i)),intFreeSpace)
  1784. strReply = getReply()
  1785. If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  1786. ' set the maxsize to be the free space on disk
  1787. intMaxSize = intFreeSpace
  1788. intOldMaximumSize = objInstance.MaximumSize
  1789. objInstance.MaximumSize = intMaxSize
  1790. If ( CInt(intIntSize) <> intOldInitialSize ) Then
  1791. objInstance.Put_(CONST_WBEM_FLAG)
  1792. If Err.Number Then
  1793. Err.Clear
  1794. WScript.Echo(L_UpdateFailed_ErrorMessage)
  1795. blnFailureMsg = TRUE
  1796. quitbasedonsuccess EXIT_INVALID_INPUT
  1797. End If
  1798. component.VBPrintf ChangeIntSuccessMessage, _
  1799. Array(UCase(arrVolume(i)),CInt(intOldInitialSize),CInt(intIntSize))
  1800. blnSuccessMsg = TRUE
  1801. Else
  1802. component.VBPrintf ChangeIntSkippingMessage, _
  1803. Array(UCase(arrVolume(i)))
  1804. blnFailureMsg = TRUE
  1805. End If
  1806. If (CInt(intMaxSize) <> intOldMaximumSize) Then
  1807. objInstance.Put_(CONST_WBEM_FLAG)
  1808. If Err.Number Then
  1809. Err.Clear
  1810. WScript.Echo(L_UpdateFailed_ErrorMessage)
  1811. blnFailureMsg = TRUE
  1812. quitbasedonsuccess EXIT_INVALID_INPUT
  1813. End If
  1814. component.VBPrintf ChangeMaxSuccessMessage, _
  1815. Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  1816. blnSuccessMsg = TRUE
  1817. Exit For
  1818. Else
  1819. component.VBPrintf ChangeMaxSkippingMessage, _
  1820. Array(UCase(arrVolume(i)))
  1821. blnFailureMsg = TRUE
  1822. Exit For
  1823. End If
  1824. ElseIf LCase(strReply) = L_UserReplyNo_Text Then
  1825. Exit For
  1826. Else
  1827. WScript.Echo(L_InvalidInput_ErrorMessage)
  1828. blnFailureMsg = TRUE
  1829. Exit For
  1830. End If
  1831. Else
  1832. intOldMaximumSize = objInstance.MaximumSize
  1833. objInstance.MaximumSize = intMaxSize
  1834. objInstance.Put_(CONST_WBEM_FLAG)
  1835. If Err.Number Then
  1836. Err.Clear
  1837. WScript.Echo(L_UpdateFailed_ErrorMessage)
  1838. blnFailureMsg = TRUE
  1839. quitbasedonsuccess EXIT_INVALID_INPUT
  1840. End If
  1841. If (CInt(intIntSize) <> intOldInitialSize ) Then
  1842. component.VBPrintf ChangeIntSuccessMessage, _
  1843. Array(UCase(arrVolume(i)),CInt(intOldInitialSize),CInt(intIntSize))
  1844. blnSuccessMsg = TRUE
  1845. Else
  1846. component.VBPrintf ChangeIntSkippingMessage, Array(UCase(arrVolume(i)))
  1847. blnFailureMsg = TRUE
  1848. End If
  1849. If (CInt(intMaxSize) <> intOldMaximumSize) Then
  1850. component.VBPrintf ChangeMaxSuccessMessage, _
  1851. Array(UCase(arrVolume(i)),CInt(intOldMaximumSize),CInt(intMaxSize))
  1852. blnSuccessMsg = TRUE
  1853. Exit For
  1854. Else
  1855. component.VBPrintf ChangeMaxSkippingMessage, Array(UCase(arrVolume(i)))
  1856. blnFailureMsg = TRUE
  1857. Exit For
  1858. End If
  1859. End If
  1860. End If
  1861. Else
  1862. ' Check if maxsize specified as 0
  1863. If Len(intMaxSize) > 0 Then
  1864. ' get the upper bound allowed for maximum size
  1865. intMaxSizeUB = getMaxSizeUB(objService)
  1866. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  1867. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  1868. blnFailureMsg = TRUE
  1869. quitbasedonsuccess EXIT_INVALID_INPUT
  1870. End If
  1871. End If ' maxsize checked
  1872. End If
  1873. End If
  1874. Else
  1875. ' get the upper bound allowed for maximum size
  1876. intMaxSizeUB = getMaxSizeUB(objService)
  1877. component.VBPrintf InitialSizeRangeErrorMessage, _
  1878. Array(intMaxSizeUB, UCase(arrVolume(i)))
  1879. blnFailureMsg = TRUE
  1880. quitbasedonsuccess EXIT_INVALID_INPUT
  1881. End If
  1882. Else
  1883. ' Check if initsize specified as 0
  1884. If Len(intIntSize) > 0 Then
  1885. ' get the upper bound allowed for maximum size
  1886. intMaxSizeUB = getMaxSizeUB(objService)
  1887. component.VBPrintf InitialSizeRangeErrorMessage, _
  1888. Array(intMaxSizeUB, UCase(arrVolume(i)))
  1889. blnFailureMsg = TRUE
  1890. quitbasedonsuccess EXIT_INVALID_INPUT
  1891. End If
  1892. End If ' initsize checked
  1893. End If
  1894. End If
  1895. Next
  1896. Else
  1897. component.VBPrintf L_PageFileDoesNotExist_ErrorMessage, _
  1898. Array(UCase(arrVolume(i)))
  1899. blnFailureMsg = TRUE
  1900. End If
  1901. Else
  1902. ' the drive does not exist
  1903. component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  1904. Array(UCase(arrVolume(i)))
  1905. blnFailureMsg = TRUE
  1906. ' remove the drive name from the valid drives list
  1907. objVols.Remove arrVolume(i)
  1908. ' decrement the loop count
  1909. i = i - 1
  1910. ' check for the no.of valid drive names from the specified list.
  1911. If Cint(objVols.Count) = 0 Then
  1912. blnFailureMsg = TRUE
  1913. quitbasedonsuccess EXIT_INVALID_INPUT
  1914. Else
  1915. intVolumes = objVols.Count
  1916. arrVolume = objVols.keys
  1917. End If
  1918. End If
  1919. i = i + 1
  1920. Loop
  1921. If blnSuccessMsg = TRUE then
  1922. WScript.Echo L_RestartComputer_Message
  1923. End If
  1924. If blnFailureMsg = TRUE Then
  1925. If blnSuccessMsg = TRUE Then
  1926. Wscript.Quit( EXIT_PARTIAL_SUCCESS)
  1927. else
  1928. Wscript.Quit( EXIT_INVALID_INPUT)
  1929. End If
  1930. End If
  1931. End Sub
  1932. '******************************************************************************
  1933. '* Sub: ProcessCreate
  1934. '*
  1935. '* Purpose: Creates new page files with the given specifications
  1936. '*
  1937. '* Input:
  1938. '* [in] strMachine machine to configure page files on
  1939. '* [in] strUserName user name to connect to the machine
  1940. '* [in] strPassword password for the user
  1941. '* [in] intIntSize the initial size for the page file
  1942. '* [in] intMaxSize the maximum size for the page file
  1943. '* [in] objVols the object containing volume names
  1944. '*
  1945. '* Output: Displays error message and quits if connection fails
  1946. '*
  1947. '******************************************************************************
  1948. Private Sub ProcessCreate( ByVal strMachine, _
  1949. ByVal strUserName, _
  1950. ByVal strPassword, _
  1951. ByVal intIntSize, _
  1952. ByVal intMaxSize, _
  1953. ByVal blnSystemManaged, _
  1954. ByVal objVols )
  1955. ON ERROR RESUME NEXT
  1956. Err.Clear
  1957. Dim arrVolume ' to store all the volumes specified
  1958. Dim intVolumes ' to store the no.of volumes specified
  1959. Dim strQuery ' to store the query for pagefiles
  1960. Dim strQueryDisk ' to store the query for disk
  1961. Dim strQueryComp ' to store the query for getting host name
  1962. Dim objService ' service object
  1963. Dim objInst ' instance object
  1964. Dim objInstance ' instance object
  1965. Dim objEnum ' collection object for query results
  1966. Dim objEnumforDisk ' collection object for query results
  1967. Dim strHostName ' to store the host name
  1968. Dim i ' Loop variable
  1969. ' variables used only if * is specified
  1970. Dim objEnumerator ' collection object for query results
  1971. i = 0
  1972. If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  1973. strUserName , _
  1974. strPassword , _
  1975. strMachine , _
  1976. blnLocalConnection , _
  1977. objService ) Then
  1978. WScript.Echo(L_HintCheckConnection_Message)
  1979. WScript.Quit(EXIT_METHOD_FAIL)
  1980. End If
  1981. If (objVols.Exists("*")) Then
  1982. ' build the query
  1983. intVolumes = 0
  1984. ' get all the drive names with drive type = 3 (other than floppy drive & CDROM Drive)
  1985. strQuery = "Select DeviceID From " & CLASS_LOGICAL_DISK & _
  1986. " where DriveType = " & DRIVE_TYPE
  1987. ' execute the query
  1988. Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 48, null)
  1989. ' check for any errors
  1990. If Err.Number Then
  1991. Err.Clear
  1992. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  1993. WScript.Quit(EXIT_QUERY_FAIL)
  1994. End If
  1995. For each objInstance in objEnumerator
  1996. ' check if the volumename is not an alias name and neither a mapped drive.
  1997. If IsValidPhysicalDrive(objService, objInstance.DeviceID) Then
  1998. ' check if the volume name is specified more than once.
  1999. If NOT objVols.Exists(LCase(objInstance.DeviceID)) Then
  2000. objVols.Add LCase(objInstance.DeviceID),-1
  2001. End If
  2002. End If
  2003. Next
  2004. ' Remove * from objVols after adding the drives to the object.
  2005. objVols.Remove "*"
  2006. End If
  2007. intVolumes = objVols.Count
  2008. arrVolume = objVols.Keys
  2009. ' Get the host Name - used to get Crash Dump Settings
  2010. strQueryComp = "Select * From " & CLASS_COMPUTER_SYSTEM
  2011. Set objEnum = objService.ExecQuery(strQueryComp, "WQL", 0, null)
  2012. ' check for any errors
  2013. If Err.Number Then
  2014. Err.Clear
  2015. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2016. WScript.Quit(EXIT_QUERY_FAIL)
  2017. End If
  2018. For each objInst in objEnum
  2019. If NOT ISEmpty(objInst.Name) Then
  2020. strHostName = objInst.Name
  2021. Else
  2022. WSCript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2023. WScript.Quit(EXIT_QUERY_FAIL)
  2024. End If
  2025. Next
  2026. ' No wild Cards Specified
  2027. Do While( i < intVolumes )
  2028. strQueryDisk = "Select * From " & CLASS_LOGICAL_DISK & _
  2029. " where DriveType = " & DRIVE_TYPE & " and DeviceID = '" & arrVolume(i) & "'"
  2030. Set objEnumforDisk = objService.ExecQuery(strQueryDisk, "WQL", 0, null)
  2031. strQuery = "Select * From " & CLASS_PAGE_FILE_SETTING & _
  2032. " where Name = '" & arrVolume(i) & "\" & PAGEFILE_DOT_SYS & "'"
  2033. Set objEnum = objService.ExecQuery(strQuery, "WQL", 0, null)
  2034. ' If valid drive and pagefile exists on that drive
  2035. If (objEnumforDisk.Count = 0 AND objEnum.Count = 0 ) Then
  2036. ' the drive does not exist
  2037. component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  2038. Array(UCase(arrVolume(i)))
  2039. bFailureMsg = TRUE
  2040. ' remove the drive name from the valid drives list
  2041. objVols.Remove arrVolume(i)
  2042. ' decrement the loop count
  2043. i = i - 1
  2044. ' check for the no.of valid drive names from the specified list.
  2045. If Cint(objVols.Count) = 0 Then
  2046. blnFailureMsg = TRUE
  2047. quitbasedonsuccess EXIT_INVALID_INPUT
  2048. Else
  2049. intVolumes = objVols.Count
  2050. arrVolume = objVols.keys
  2051. End If
  2052. Else
  2053. ' SKIP - if at least one instance is found then dont create a new instance
  2054. If (objEnumforDisk.Count = 1 AND objEnum.Count = 1) Then
  2055. component.VBPrintf L_CreateSkipping_Message, _
  2056. Array(UCase(arrVolume(i)))
  2057. blnFailureMsg = TRUE
  2058. Else
  2059. ' check if the volumename is an alias name or a mapped drive
  2060. If NOT IsValidPhysicalDrive(objService, arrVolume(i)) Then
  2061. component.VBPrintf L_InvalidPhysicalDrive_ErrorMessage, _
  2062. Array(UCase(arrVolume(i)))
  2063. blnFailureMsg = TRUE
  2064. Else
  2065. CreatePageFile objService, arrVolume, blnSystemManaged, _
  2066. intIntSize, intMaxSize, strMachine, strUserName, _
  2067. strPassword, strHostName, i
  2068. End If
  2069. End If
  2070. End If
  2071. i = i + 1
  2072. Loop
  2073. ' Prompt for reboot if atleast one operation is successful
  2074. If blnSuccessMsg = TRUE then
  2075. WScript.Echo L_RestartComputer_Message
  2076. End If
  2077. ' DEcide on the return level. If atleast one succeds, return partial success.. If all fails return complete failure
  2078. If blnFailureMsg = TRUE Then
  2079. If blnSuccessMsg = TRUE Then
  2080. Wscript.Quit( EXIT_PARTIAL_SUCCESS)
  2081. else
  2082. Wscript.Quit( EXIT_INVALID_INPUT)
  2083. End If
  2084. End If
  2085. End Sub
  2086. '**************************************************************************************************
  2087. '* sub: CreatePageFile
  2088. '*
  2089. '* Purpose: Creates new page file on a specified drive at the specified index
  2090. '*
  2091. '* INPUT:
  2092. '*
  2093. '* [IN] objService The WMI service object
  2094. '* [IN] arrVolume Array of volumes to create the page files on
  2095. '* [IN] blnSystemManaged Indicates whether the drive has to be system managed
  2096. '* [IN] intIntSize Indicates the InitialSize
  2097. '* [IN] intMaxSize Indicates the Maximum Size
  2098. '* [IN] strMachine The system to connect to
  2099. '* [IN] strUserName User name
  2100. '* [IN] strPassword Password
  2101. '* [IN] strHostName The host name for the remote machine
  2102. '* [IN] i The index of the drive name in arrVolume to create the page file
  2103. '*
  2104. '**************************************************************************************************
  2105. Private Sub CreatePageFile(ByVal objService, _
  2106. ByVal arrVolume, _
  2107. ByVal blnSystemManaged, _
  2108. ByVal intIntSize, _
  2109. ByVal intMaxSize, _
  2110. ByVal strMachine, _
  2111. ByVal strUserName, _
  2112. ByVal strPassword, _
  2113. ByVal strHostName, _
  2114. BYVal i)
  2115. ON ERROR RESUME NEXT
  2116. Dim objInstance ' instance object
  2117. Dim objNewInstance ' instance object
  2118. Dim intFreeSpace ' to store total free space
  2119. Dim intFreeDiskSpace ' to store free disk space
  2120. Dim intCurrentSize ' to store the current pagefile size
  2121. Dim intDiskSize ' to store the disk size for the specified disk
  2122. Dim intMemSize ' to store physical memory size
  2123. Dim intCrashDump ' to store the current crash dump setting value
  2124. Dim strReply ' to store the user reply
  2125. Dim intMaxSizeUB ' to store the upper bound for maximum size
  2126. intFreeSpace = 0
  2127. intFreeDiskSpace = 0
  2128. intCurrentSize = 0
  2129. intMaxSizeUB = 0
  2130. Err.Clear
  2131. ' set the security privilege to allow pagefile creation
  2132. objService.Security_.Privileges.AddAsString("SeCreatePagefilePrivilege")
  2133. If Err.Number then
  2134. Err.Clear
  2135. WScript.Echo("ERROR: Failed to set the security privilege.")
  2136. blnFailureMsg = TRUE
  2137. quitbasedonsuccess EXIT_METHOD_FAIL
  2138. End If
  2139. Set objInstance = objService.Get(CLASS_PAGE_FILE_SETTING)
  2140. ' check for any errors
  2141. If Err.Number Then
  2142. Err.Clear
  2143. Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2144. blnFailureMsg = TRUE
  2145. quitbasedonsuccess EXIT_METHOD_FAIL
  2146. End If
  2147. Set objNewInstance = objInstance.SpawnInstance_
  2148. ' check for any errors
  2149. If Err.Number Then
  2150. Err.Clear
  2151. Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2152. blnFailureMsg = TRUE
  2153. quitbasedonsuccess EXIT_INVALID_INPUT
  2154. End If
  2155. ' append the filename to the volume name
  2156. objNewInstance.Name = UCase(arrVolume(i)) & PAGEFILE_DOT_SYS
  2157. 'Check if the page file has to be managed by the system
  2158. If blnSystemManaged = TRUE Then
  2159. objNewInstance.InitialSize = CONST_SYSTEM_INIT_SIZE
  2160. objNewInstance.MaximumSize = CONST_SYSTEM_MAX_SIZE
  2161. objNewInstance.Put_(CONST_WBEM_FLAG)
  2162. If Err.Number Then
  2163. Err.Clear
  2164. Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2165. blnFailureMsg = TRUE
  2166. quitbasedonsuccess EXIT_INVALID_INPUT
  2167. End If
  2168. component.VBPrintf L_CreateSystemSuccess_message, _
  2169. Array(UCase(arrVolume(i)))
  2170. blnSuccessMsg = TRUE
  2171. ' If not System managed
  2172. Else
  2173. ' check if maxsize is greater than initsize
  2174. ' this will detect any overflow problems, if any
  2175. If ( CLng(intIntSize) > CLng(intMaxSize) ) Then
  2176. ' check for overflows and clear the error
  2177. If Err.Number Then Err.Clear
  2178. ' get the upper bound allowed for maximum size
  2179. intMaxSizeUB = getMaxSizeUB(objService)
  2180. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  2181. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  2182. blnFailureMsg = TRUE
  2183. Exit Sub
  2184. End If
  2185. ' Check the initial size with the free space on the disk
  2186. If CLng(intIntSize) >= CLng(INITIAL_SIZE_LB) Then
  2187. ' check for overflows
  2188. If Err.Number Then
  2189. Err.Clear
  2190. WScript.Echo(L_InvalidInput_ErrorMessage)
  2191. blnFailureMsg = TRUE
  2192. quitbasedonsuccess EXIT_INVALID_INPUT
  2193. End If
  2194. ' get the free space on the specified disk
  2195. intFreeDiskSpace = getFreeSpaceOnDisk(arrVolume(i),objService)
  2196. ' get the total free space Since its a new instane the current size willNOT be available. So the initial size is taken into considerarion for calculating the total free space.
  2197. intFreeSpace = intFreeDiskSpace
  2198. ' Check if it greater than free disk space
  2199. If CLng(intIntSize) > CLng(intFreeSpace) Then
  2200. ' check for overflows
  2201. If Err.Number Then
  2202. Err.Clear
  2203. WScript.Echo(L_InvalidInput_ErrorMessage)
  2204. blnFailureMsg = TRUE
  2205. quitbasedonsuccess EXIT_INVALID_INPUT
  2206. End If
  2207. component.VBPrintf NotEnoughSpaceErrorMessage, Array( UCase(arrVolume(i)))
  2208. blnFailureMsg = TRUE
  2209. Exit Sub
  2210. End If
  2211. If CLng(intIntSize) > CLng(intFreeSpace) - 5 Then
  2212. ' check for overflows
  2213. If Err.Number Then
  2214. Err.Clear
  2215. WScript.Echo(L_InvalidInput_ErrorMessage)
  2216. blnFailureMsg = TRUE
  2217. quitbasedonsuccess EXIT_INVALID_INPUT
  2218. End If
  2219. component.VBPrintf AtLeastFiveMBErrorMessage, Array( UCase(arrVolume(i)))
  2220. blnFailureMsg = TRUE
  2221. Exit Sub
  2222. End If
  2223. ' get the crash dump setting value
  2224. intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  2225. ' get the Physical Memory Size
  2226. intMemSize = GetPhysicalMemorySize(strHostName,objService)
  2227. ' check if the user has selected "yes" for the warning message
  2228. If isCrashDumpValueSet(intCrashDump,intIntSize,intMemSize,arrVolume(i)) Then
  2229. objNewInstance.InitialSize = CInt(intIntSize)
  2230. ' Get the Disk Size for the specified drive
  2231. intDiskSize = GetDiskSize(arrVolume(i),objService)
  2232. If (CLng(intMaxSize) > CLng(intDiskSize)) Then
  2233. ' check for overflows
  2234. If Err.Number Then
  2235. Err.Clear
  2236. ' get the upper bound allowed for maximum size
  2237. intMaxSizeUB = getMaxSizeUB(objService)
  2238. component.VBPrintf InsufficientMaxSizeErrorMessage, _
  2239. Array( UCase(arrVolume(i)) , intMaxSizeUB )
  2240. blnFailureMsg = TRUE
  2241. quitbasedonsuccess EXIT_INVALID_INPUT
  2242. End If
  2243. component.VBPrintf DiskTooSmallErrorMessage, _
  2244. Array(UCase(arrVolume(i)))
  2245. blnFailureMsg = TRUE
  2246. Exit Sub
  2247. ElseIf (CLng(intMaxSize) > CLng(intFreeSpace)) Then
  2248. ' check for overflows
  2249. If Err.Number Then
  2250. Err.Clear
  2251. WScript.Echo(L_InvalidInput_ErrorMessage)
  2252. blnFailureMsg = TRUE
  2253. quitbasedonsuccess EXIT_INVALID_INPUT
  2254. End If
  2255. component.VBPrintf GrowsToFreeSpaceWarningMessage, _
  2256. Array(UCase(arrVolume(i)),intFreeSpace)
  2257. strReply = getReply()
  2258. If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  2259. ' maxsize can grow only to the free disk space available.
  2260. ' set the maxsize to the free space on disk.
  2261. intMaxSize = intFreeSpace
  2262. objNewInstance.MaximumSize = intMaxSize
  2263. objNewInstance.Put_(CONST_WBEM_FLAG)
  2264. If Err.Number Then
  2265. Err.Clear
  2266. Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2267. blnFailureMsg = TRUE
  2268. quitbasedonsuccess EXIT_INVALID_INPUT
  2269. End If
  2270. component.VBPrintf CreateSuccessMessage, _
  2271. Array(CInt(intIntSize),CInt(intMaxSize),UCase(arrVolume(i)))
  2272. blnSuccessMsg = TRUE
  2273. ElseIf LCase(strReply) = L_UserReplyNo_Text Then
  2274. Exit Sub
  2275. Else
  2276. WScript.Echo(L_InvalidInput_ErrorMessage)
  2277. blnFailureMsg = TRUE
  2278. Exit Sub
  2279. End If
  2280. Else
  2281. objNewInstance.MaximumSize = CInt(intMaxSize)
  2282. objNewInstance.Put_(CONST_WBEM_FLAG)
  2283. If Err.Number Then
  2284. Err.Clear
  2285. Component.VBPrintf L_CannotCreate_ErrorMessage,Array(Ucase(arrVolume(i)))
  2286. blnFailureMsg = TRUE
  2287. quitbasedonsuccess EXIT_INVALID_INPUT
  2288. End If
  2289. component.VBPrintf CreateSuccessMessage, _
  2290. Array(CInt(intIntSize),CInt(intMaxSize),UCase(arrVolume(i)))
  2291. blnSuccessMsg = TRUE
  2292. End If
  2293. End If 'End of IsCrashDumpset
  2294. Else 'If initial size is less than 2 MB
  2295. ' get the upper bound allowed for maximum size
  2296. intMaxSizeUB = getMaxSizeUB(objService)
  2297. component.VBPrintf InitialSizeRangeErrorMessage, _
  2298. Array(intMaxSizeUB, UCase(arrVolume(i)))
  2299. blnFailureMsg = TRUE
  2300. End If
  2301. End If
  2302. ' End of system managed If condition
  2303. End Sub
  2304. '******************************************************************************
  2305. '* Sub: ProcessDelete
  2306. '*
  2307. '* Purpose: Deletes existing page files on the specified volumes
  2308. '*
  2309. '* Input:
  2310. '* [in] strMachine machine to configure page files on
  2311. '* [in] strUserName user name to connect to the machine
  2312. '* [in] strPassword password for the user
  2313. '* [in] objVols the object containing volume names
  2314. '*
  2315. '* Output: Displays error message and quits if connection fails
  2316. '*
  2317. '******************************************************************************
  2318. Private Sub ProcessDelete ( ByVal strMachine, _
  2319. ByVal strUserName, _
  2320. ByVal strPassword, _
  2321. ByVal blnSystemManaged, _
  2322. ByVal objVols )
  2323. ON ERROR RESUME NEXT
  2324. Err.Clear
  2325. Dim arrVolume ' to store all the volumes specified
  2326. Dim intVolumes ' to store the no.of volumes specified
  2327. Dim objService ' service object
  2328. Dim objInstance ' instance object
  2329. Dim strQueryDisk ' to store the query for disk
  2330. Dim objEnumforDisk ' collection object for query results
  2331. Dim intMemSize ' to store physical memory size
  2332. Dim intCrashDump ' to store the current crash dump setting value
  2333. Dim strQueryComp ' to store the query for computersystem
  2334. Dim objEnum ' collection object for query results
  2335. Dim objInst ' instance object
  2336. Dim strHostName ' to store the host name
  2337. Dim i ' Loop variable
  2338. Dim strQueryPageFile ' to store the query for pagefiles
  2339. Dim objEnumPageFile ' collection object for pagefiles
  2340. ' Establish connection to WMI to get pagefile info
  2341. If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  2342. strUserName , _
  2343. strPassword , _
  2344. strMachine , _
  2345. blnLocalConnection , _
  2346. objService ) Then
  2347. WScript.Echo(L_HintCheckConnection_Message)
  2348. WScript.Quit(EXIT_METHOD_FAIL)
  2349. End If
  2350. i = 0
  2351. intVolumes = objVols.Count
  2352. arrVolume = objVols.Keys
  2353. ' Get the host Name - used to get Crash Dump Settings
  2354. strQueryComp = "Select * From " & CLASS_COMPUTER_SYSTEM
  2355. Set objEnum = objService.ExecQuery(strQueryComp, "WQL", 0, null)
  2356. ' check for any errors
  2357. If Err.Number Then
  2358. Err.Clear
  2359. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2360. WScript.Quit(EXIT_QUERY_FAIL)
  2361. End If
  2362. For each objInst in objEnum
  2363. If NOT ISEmpty(objInst.Name) Then
  2364. strHostName = objInst.Name
  2365. Else
  2366. WSCript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2367. WScript.Quit(EXIT_QUERY_FAIL)
  2368. End If
  2369. Next
  2370. Do While( i < intVolumes )
  2371. strQueryDisk = "Select * From " & CLASS_LOGICAL_DISK & _
  2372. " where DriveType = " & DRIVE_TYPE & " and DeviceID = '" & arrVolume(i) & "'"
  2373. Set objEnumforDisk = objService.ExecQuery(strQueryDisk, "WQL", 0, null)
  2374. If objEnumforDisk.Count > 0 Then
  2375. Set objInstance = objService.Get(CLASS_PAGE_FILE_SETTING & "='" & _
  2376. arrVolume(i) & PAGEFILE_DOT_SYS & "'")
  2377. If Err.Number Then
  2378. Err.Clear
  2379. component.VBPrintf L_PageFileDoesNotExist_ErrorMessage, _
  2380. Array(UCase(arrVolume(i)))
  2381. blnFailureMsg = TRUE
  2382. Else
  2383. intCrashDump = GetCrashDumpSetting(strUserName,strPassword,strMachine)
  2384. ' get the Physical Memory Size
  2385. intMemSize = GetPhysicalMemorySize(strHostName,objService)
  2386. ' If the user has selected "yes" for the warning message
  2387. ' pass initsize as 0 because initsize = maxsize = 0 (assumed) after deletion
  2388. If isCrashDumpValueSet(intCrashDump,0,intMemSize,arrVolume(i)) Then
  2389. strQueryPageFile = "Select * from " & CLASS_PAGE_FILE_SETTING
  2390. Set objEnumPageFile = objService.ExecQuery(strQueryPageFile, "WQL", 0, null)
  2391. If objEnumPageFile.Count > 1 Then
  2392. ' Delete the instance
  2393. objInstance.Delete_
  2394. ' check for any errors
  2395. If Err.Number Then
  2396. Err.Clear
  2397. WScript.Echo(L_InvalidInput_ErrorMessage)
  2398. blnFailureMsg = TRUE
  2399. quitbasedonsuccess EXIT_INVALID_INPUT
  2400. End If
  2401. component.VBPrintf L_DeleteSuccess_Message, _
  2402. Array(UCase(arrVolume(i)))
  2403. blnSuccessMsg = TRUE
  2404. Else
  2405. component.VBPrintf CannotDeleteErrorMessage, _
  2406. Array(UCase(arrVolume(i)))
  2407. blnFailureMsg = TRUE
  2408. End If
  2409. End If
  2410. End If
  2411. Else
  2412. ' the drive does not exist
  2413. component.VBPrintf L_InvalidVolumeName_ErrorMessage, _
  2414. Array(UCase(arrVolume(i)))
  2415. blnFailureMsg = TRUE
  2416. ' remove the drive name from the valid drives list
  2417. objVols.Remove arrVolume(i)
  2418. ' decrement the loop count
  2419. i = i - 1
  2420. ' check for the no.of valid drive names from the specified list.
  2421. If Cint(objVols.Count) = 0 Then
  2422. blnFailureMsg = TRUE
  2423. quitbasedonsuccess EXIT_INVALID_INPUT
  2424. Else
  2425. intVolumes = objVols.Count
  2426. arrVolume = objVols.keys
  2427. End If
  2428. End If
  2429. i = i + 1
  2430. Loop
  2431. ' The instances of the following classes are also deleted along with the Win32_PageFile instances
  2432. ' Win32_PageFileUsage - instances are deleted only after reboot
  2433. ' Win32_PageFileSetting - instances are deleted automatically along with Win32_PageFile instances
  2434. If blnSuccessMsg = TRUE then
  2435. WScript.Echo L_RestartComputer_Message
  2436. End If
  2437. ' DEcide on the return level. If atleast one succeds, return partial success.. If all fails return complete failure
  2438. If blnFailureMsg = TRUE Then
  2439. If blnSuccessMsg = TRUE Then
  2440. Wscript.Quit( EXIT_PARTIAL_SUCCESS)
  2441. else
  2442. Wscript.Quit( EXIT_INVALID_INPUT)
  2443. End If
  2444. End If
  2445. End sub
  2446. '******************************************************************************
  2447. '* Sub: ProcessQuery
  2448. '*
  2449. '* Purpose: Displays the Page File Details in the specified format
  2450. '*
  2451. '* Input:
  2452. '* [in] strMachine machine to configure page files on
  2453. '* [in] strUserName user name to connect to the machine
  2454. '* [in] strPassword password for the user
  2455. '* [in] strFormat the query display format
  2456. '* [in] blnNoHeader flag to store if -nh is specified or not
  2457. '*
  2458. '* Output: Displays error message and quits if connection fails
  2459. '* Calls component.showResults() to display the page file
  2460. '* details
  2461. '*
  2462. '******************************************************************************
  2463. Private Sub ProcessQuery( ByVal strMachine, _
  2464. ByVal strUserName, _
  2465. ByVal strPassword, _
  2466. ByVal strFormat, _
  2467. ByVal blnSystemManaged, _
  2468. ByVal blnNoHeader )
  2469. ON ERROR RESUME NEXT
  2470. Err.Clear
  2471. Dim objEnumerator ' to store the results of the query is executed
  2472. Dim objInstance ' to refer to the instances of the objEnumerator
  2473. Dim strQuery ' to store the query obtained for given conditions
  2474. Dim intTotSize ' to store the total size on all drives
  2475. Dim intRecommendedSize ' to store the recommended size for all drives
  2476. Dim arrResultsDrives ' to store the columns of page file info.
  2477. Dim arrHeaderDrives ' to store the array header values
  2478. Dim arrMaxLengthDrives ' to store the maximum length for each column
  2479. Dim arrFinalResultsDrives ' used to send the arrResults to ShowResults()
  2480. Dim intColumnCountDrives ' number of columns to be displayed in the output
  2481. Dim blnPrintHeaderDrives ' variable which decides whether header is to be displayed or not
  2482. Dim arrResultsSummary ' to store the columns of page file info.
  2483. Dim arrHeaderSummary ' to store the array header values
  2484. Dim arrMaxLengthSummary ' to store the maximum length for each column
  2485. Dim arrFinalResultsSummary ' used to send the arrResults to ShowResults()
  2486. Dim intColumnCountSummary ' number of columns to be displayed in the output
  2487. Dim blnPrintHeaderSummary ' variable which decides whether header is to be displayed or not
  2488. Dim objDiskDriveInstance ' Instance for drive name
  2489. Dim objMemSizeInstance ' Instance for memory size
  2490. Dim arrblnNoDisplayDrives ' boolean variable for -noheader option
  2491. Dim arrblnNoDisplaySummary ' boolean variable for -noheader option
  2492. Dim objService ' service object
  2493. Dim strDriveName ' to store the drive name
  2494. Dim objUsageInstance ' Instance for PageFileUsage
  2495. ' Initializing the blnPrintHeaders to true. Header should be printed by default
  2496. blnPrintHeaderDrives = TRUE
  2497. blnPrintHeaderSummary = TRUE
  2498. intTotSize = 0
  2499. If blnNoHeader Then
  2500. blnPrintHeaderDrives = FALSE
  2501. blnPrintHeaderSummary = FALSE
  2502. End If
  2503. ' Establish connection to WMI to get pagefile information
  2504. If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  2505. strUserName , _
  2506. strPassword , _
  2507. strMachine , _
  2508. blnLocalConnection , _
  2509. objService ) Then
  2510. WScript.Echo(L_HintCheckConnection_Message)
  2511. WScript.Quit(EXIT_METHOD_FAIL)
  2512. End If
  2513. arrHeaderDrives = Array(L_ColHeaderHostname_Text , L_ColHeaderDrive_Text, _
  2514. L_ColHeaderVolumeLabel_Text, L_ColHeaderFileName_Text, _
  2515. L_ColHeaderInitialSize_Text, L_ColHeaderMaximumSize_Text, _
  2516. L_ColHeaderCurrentSize_Text, L_ColHeaderFreeSpace_Text,_
  2517. L_ColHeaderPageFileStatus_Text)
  2518. arrHeaderSummary = Array(L_ColHeaderHostname_Text, L_ColHeaderTotalMinimumSize_Text, _
  2519. L_ColHeaderTotalRecommendedSize_Text, L_ColHeaderTotalSize_Text)
  2520. ' Data Lengths = (15,13,13,19,20,20,20,22)
  2521. arrMaxLengthDrives = Array(L_CONST_HOSTNAME_Length_Text, L_CONST_DRIVENAME_Length_Text, L_CONST_VOLLABEL_Length_Text, _
  2522. L_CONST_PAGEFILENAME_Length_Text, L_CONST_INTSIZE_Length_Text, L_CONST_MAXSIZE_Length_Text, _
  2523. L_CONST_CURRENTSIZE_Length_Text, L_CONST_FREESPACE_Length_Text, _
  2524. L_ColHeaderPageFileStatusLength_Text)
  2525. ' Data Lengths = (15,33,37,40)
  2526. arrMaxLengthSummary = Array(L_CONST_HOSTNAME_Length_Text, L_CONST_TOTALMINSIZE_Length_Text,_
  2527. L_CONST_TOTALRECSIZE_Length_Text, L_CONST_TOTALSIZE_Length_Text)
  2528. arrblnNoDisplayDrives = Array(0,0,0,0,0,0,0,0,0)
  2529. arrblnNoDisplaySummary = Array(0,0,0,0)
  2530. ' first initialize the array with N/A
  2531. arrResultsDrives = Array(L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text,_
  2532. L_Na_Text,L_Na_Text, L_Na_Text)
  2533. arrResultsSummary = Array(L_Na_Text,L_Na_Text,L_Na_Text,L_Na_Text)
  2534. ' build the query
  2535. strQuery = "SELECT * FROM " & CLASS_PAGE_FILE_SETTING
  2536. ' execute the query
  2537. Set objEnumerator = objService.ExecQuery(strQuery, "WQL", 0, null)
  2538. ' check for any errors
  2539. If Err.Number Then
  2540. Err.Clear
  2541. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2542. WScript.Quit(EXIT_QUERY_FAIL)
  2543. End If
  2544. ' If no.of pagefile instances are 0 (zero)
  2545. If (objEnumerator.Count = 0) Then
  2546. WScript.Echo(L_NoPageFiles_Message)
  2547. WScript.Quit(EXIT_UNEXPECTED)
  2548. End If
  2549. ReDim arrFinalResultsDrives(0)
  2550. ReDim arrFinalResultsSummary(0)
  2551. If(LCase(strFormat) <> "csv") Then
  2552. WScript.Echo("") ' Blank Line
  2553. End If
  2554. ' Loop through all the instances for the first report
  2555. For each objInstance in objEnumerator
  2556. If NOT IsEmpty(objInstance.Name) Then
  2557. strDriveName = Mid(objInstance.Name,1,2)
  2558. End If
  2559. ' check if it is a valid physical drive
  2560. If IsValidPhysicalDrive(objService,strDriveName) Then
  2561. If IsEmpty(objInstance.Name) Then
  2562. arrResultsDrives(1) = L_Na_Text
  2563. Else
  2564. strDriveName = Mid(objInstance.Name,1,2)
  2565. arrResultsDrives(1) = UCase(strDriveName)
  2566. End If
  2567. ' to get the data from Win32_PageFileUsage
  2568. Set objUsageInstance = objService.Get(CLASS_PAGE_FILE_USAGE & "='" & objInstance.Name & "'")
  2569. ' to get the current size
  2570. If Len(objUsageInstance.AllocatedBaseSize) = 0 Then
  2571. arrResultsDrives(6) = L_Na_Text
  2572. Else
  2573. arrResultsDrives(6) = objUsageInstance.AllocatedBaseSize & MEGA_BYTES
  2574. intTotSize = intTotSize + objUsageInstance.AllocatedBaseSize
  2575. End If
  2576. ' To set the PageFile status field
  2577. If (objInstance.InitialSize = 0 AND objInstance.MaximumSize = 0) Then
  2578. arrResultsDrives(8) = L_CONST_System_Managed_Text
  2579. Else
  2580. arrResultsDrives(8) = L_Custom_Text
  2581. End If
  2582. ' to get the data from Win32_LogicalDisk
  2583. Set objDiskDriveInstance = objService.Get(CLASS_LOGICAL_DISK & "='" & strDriveName & "'")
  2584. If Len(objDiskDriveInstance.VolumeName) = 0 Then
  2585. arrResultsDrives(2) = L_Na_Text
  2586. Else
  2587. arrResultsDrives(2) = objDiskDriveInstance.VolumeName
  2588. End If
  2589. If Len(objDiskDriveInstance.SystemName) = 0 Then
  2590. arrResultsDrives(0) = L_Na_Text
  2591. Else
  2592. arrResultsDrives(0) = objDiskDriveInstance.SystemName
  2593. arrResultsSummary(0) = objDiskDriveInstance.SystemName
  2594. End If
  2595. If (objDiskDriveInstance.FreeSpace) Then
  2596. arrResultsDrives(7) = Int(objDiskDriveInstance.FreeSpace/CONVERSION_FACTOR) + Int(objUsageInstance.AllocatedBaseSize) &_
  2597. MEGA_BYTES
  2598. Else
  2599. arrResultsDrives(7) = L_Na_Text
  2600. End If
  2601. If IsEmpty(objInstance.Name) Then
  2602. arrResultsDrives(3) = L_Na_Text
  2603. Else
  2604. arrResultsDrives(3) = objInstance.Name
  2605. End If
  2606. If objInstance.InitialSize Then
  2607. arrResultsDrives(4) = objInstance.InitialSize & MEGA_BYTES
  2608. Else
  2609. arrResultsDrives(4) = L_Na_Text
  2610. End If
  2611. If objInstance.MaximumSize Then
  2612. arrResultsDrives(5) = objInstance.MaximumSize & MEGA_BYTES
  2613. Else
  2614. arrResultsDrives(5) = L_Na_Text
  2615. End If
  2616. arrFinalResultsDrives(0) = arrResultsDrives
  2617. Call component.showResults(arrHeaderDrives, arrFinalResultsDrives, arrMaxLengthDrives, _
  2618. strFormat, blnPrintHeaderDrives, arrblnNoDisplayDrives)
  2619. blnPrintHeaderDrives = FALSE
  2620. End If
  2621. Next
  2622. WScript.Echo("")
  2623. ' Display the summary report
  2624. arrResultsSummary(1) = INITIAL_SIZE_LB & MEGA_BYTES
  2625. Set objMemSizeInstance = objService.Get(CLASS_COMPUTER_SYSTEM & "='" & arrResultsDrives(0) & "'")
  2626. If objMemSizeInstance.TotalPhysicalMemory Then
  2627. intRecommendedSize = Int(Int(objMemSizeInstance.TotalPhysicalMemory/CONVERSION_FACTOR)* SIZE_FACTOR)
  2628. arrResultsSummary(2) = intRecommendedSize & MEGA_BYTES
  2629. Else
  2630. arrResultsSummary(2) = L_Na_Text
  2631. End If
  2632. arrResultsSummary(3) = intTotSize & MEGA_BYTES
  2633. arrFinalResultsSummary(0) = arrResultsSummary
  2634. Call component.showResults(arrHeaderSummary, arrFinalResultsSummary, arrMaxLengthSummary, strFormat, _
  2635. blnPrintHeaderSummary,arrblnNoDisplaySummary)
  2636. blnPrintHeaderSummary = FALSE
  2637. End Sub
  2638. '******************************************************************************
  2639. '* Function: IsValidPhysicalDrive
  2640. '*
  2641. '* Purpose: To check if the specified drive is a valid physical drive.
  2642. '* This check is done only for Win2K builds
  2643. '*
  2644. '* Input:
  2645. '* [in] objServiceParam service object to maintain wmi connection.
  2646. '* [in] strDriveName drive name whose validity has to be checked.
  2647. '*
  2648. '* Output: Returns TRUE or FALSE
  2649. '* TRUE - when the drive is a valid physical drive.
  2650. '* FALSE - when the drive is not a valid physical drive.
  2651. '*
  2652. '******************************************************************************
  2653. Private Function IsValidPhysicalDrive ( ByVal objServiceParam, _
  2654. ByVal strDriveName )
  2655. ON ERROR RESUME NEXT
  2656. Err.Clear
  2657. CONST WIN2K_MAJOR_VERSION = 5000
  2658. CONST WINXP_MAJOR_VERSION = 5001
  2659. Dim strQuery ' to store the query to be executed
  2660. Dim objEnum ' collection object
  2661. Dim objInstance ' instance object
  2662. Dim strValidDrives ' to store all valid physical drives
  2663. Dim strVersion ' to store the OS version
  2664. Dim arrVersionElements ' to store the OS version elements
  2665. Dim CurrentMajorVersion ' the major version number
  2666. strValidDrives = ""
  2667. ' by default set it to true
  2668. IsValidPhysicalDrive = TRUE
  2669. strquery = "Select * From " & CLASS_OPERATING_SYSTEM
  2670. set objEnum = objServiceParam.ExecQuery(strQuery,"WQL",48,null)
  2671. For each objInstance in objEnum
  2672. strVersion= objInstance.Version
  2673. Next
  2674. ' OS Version : 5.1.xxxx(Windows XP), 5.0.xxxx(Windows 2000)
  2675. arrVersionElements = split(strVersion,".")
  2676. ' converting to major version
  2677. CurrentMajorVersion = arrVersionElements(0) * 1000 + arrVersionElements(1)
  2678. ' Determine the OS Type
  2679. ' If the OS version is 5.1 or later, then NO NEED to validate.
  2680. ' If the OS is Win2K, then validate the drive name.
  2681. If CInt(CurrentMajorVersion) <= CInt(WINXP_MAJOR_VERSION) Then
  2682. strQuery = "Select * From " & CLASS_PERFDISK_PHYSICAL_DISK
  2683. Set objEnum = objServiceParam.ExecQuery(strQuery, "WQL", 0, null)
  2684. For each objInstance in objEnum
  2685. ' get all the instance except the last one
  2686. If (objInstance.Name <> "_Total") Then
  2687. strValidDrives = strValidDrives & " " & objInstance.Name
  2688. End If
  2689. Next
  2690. ' check if the specified drive is present in the list of valid physical drives
  2691. If Instr(strValidDrives, UCase(strDriveName)) = 0 Then
  2692. IsValidPhysicalDrive = FALSE
  2693. End If
  2694. End If
  2695. End Function
  2696. '******************************************************************************
  2697. '* Function: getFreeSpaceOnDisk
  2698. '*
  2699. '* Purpose: To get the Free Space for the Specified Disk
  2700. '*
  2701. '* Input:
  2702. '* [in] strDriveName drive name whose free space is needed
  2703. '* [in] objServiceParam service object to maintain wmi connection
  2704. '*
  2705. '* Output: Returns the free space (in MB) on the specified disk.
  2706. '*
  2707. '******************************************************************************
  2708. Private Function getFreeSpaceOnDisk(ByVal strDriveName, ByVal objServiceParam)
  2709. ON ERROR RESUME NEXT
  2710. Err.Clear
  2711. Dim objValidDiskInst
  2712. Set objValidDiskInst = objServiceParam.Get(CLASS_LOGICAL_DISK & "='" & strDriveName & "'")
  2713. If Err.Number Then
  2714. Err.Clear
  2715. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2716. blnFailureMsg = TRUE
  2717. QuitbasedonSuccess EXIT_QUERY_FAIL
  2718. End If
  2719. getFreeSpaceOnDisk = Int(objValidDiskInst.FreeSpace/CONVERSION_FACTOR)
  2720. End Function
  2721. '******************************************************************************
  2722. '* Function: getCurrentPageFileSize
  2723. '*
  2724. '* Purpose: To get the current pagefile size on the specified drive
  2725. '*
  2726. '* Input:
  2727. '* [in] objService wbem service object
  2728. '* [in] objInstance instance of win32_pagefilesetting
  2729. '*
  2730. '* Output: current pagefile size
  2731. '*
  2732. '******************************************************************************
  2733. Private Function getCurrentPageFileSize(ByVal objService, ByVal objInstance)
  2734. ON ERROR RESUME NEXT
  2735. Err.Clear
  2736. Dim objUsageInstance
  2737. ' get the data from Win32_PageFileUsage
  2738. Set objUsageInstance = objService.Get(CLASS_PAGE_FILE_USAGE & "='" & objInstance.Name & "'")
  2739. ' return the current size ( allocated base size )
  2740. getCurrentPageFileSize = objUsageInstance.AllocatedBaseSize
  2741. End Function
  2742. '******************************************************************************
  2743. '* Function: GetDiskSize
  2744. '*
  2745. '* Purpose: To get the disk size for the specified drive
  2746. '*
  2747. '* Input:
  2748. '* [in] strDriveName drive name whose free space is needed
  2749. '* [in] objServiceParam service object to maintain wmi connection
  2750. '*
  2751. '* Output: Returns the total disk size in MB.
  2752. '*
  2753. '******************************************************************************
  2754. Private Function GetDiskSize(ByVal strDriveName, ByVal objServiceParam)
  2755. ON ERROR RESUME NEXT
  2756. Err.Clear
  2757. Dim objValidDiskInst ' object to store valid disk name
  2758. Set objValidDiskInst = objServiceParam.Get(CLASS_LOGICAL_DISK & "='" & strDriveName & "'")
  2759. If Err.Number Then
  2760. Err.Clear
  2761. WScript.Echo(L_UnableToRetrieveInfo_ErrorMessage)
  2762. blnFailureMsg = TRUE
  2763. QuitBasedOnSuccess EXIT_QUERY_FAIL
  2764. End If
  2765. GetDiskSize = Int(objValidDiskInst.Size / CONVERSION_FACTOR)
  2766. End Function
  2767. '******************************************************************************
  2768. '* Function: GetPhysicalMemorySize
  2769. '*
  2770. '* Purpose: To get the physical memory size.
  2771. '*
  2772. '* Input:
  2773. '* [in] strHostName host name to connect to
  2774. '* [in] objServiceParam service object to maintain wmi connection
  2775. '*
  2776. '* Output: Returns the physical memory size in MB.
  2777. '*
  2778. '******************************************************************************
  2779. Private Function GetPhysicalMemorySize( ByVal strHostName, ByVal objServiceParam )
  2780. ON ERROR RESUME NEXT
  2781. Err.Clear
  2782. Dim objMemSizeInstance ' to store memory size
  2783. Dim intReturnValue ' to store return value
  2784. Set objMemSizeInstance = objServiceParam.Get(CLASS_COMPUTER_SYSTEM & "='" & strHostName & "'")
  2785. If Err.Number Then
  2786. Err.Clear
  2787. WScript.Echo L_UnableToRetrieveInfo_ErrorMessage
  2788. blnFailureMsg = TRUE
  2789. QuitBasedOnSuccess EXIT_QUERY_FAIL
  2790. End If
  2791. If objMemSizeInstance.TotalPhysicalMemory Then
  2792. intReturnValue = Int(objMemSizeInstance.TotalPhysicalMemory/CONVERSION_FACTOR)
  2793. GetPhysicalMemorySize = intReturnValue
  2794. End If
  2795. End Function
  2796. '******************************************************************************
  2797. '* Function: getMaxSizeUB
  2798. '*
  2799. '* Purpose: To get the allowed upper bound for maximum size
  2800. '*
  2801. '* Input:
  2802. '* [in] objServiceParam service object to maintain wmi connection
  2803. '*
  2804. '* Output: Returns the upper bound for maximum size
  2805. '*
  2806. '******************************************************************************
  2807. Private Function getMaxSizeUB(objServiceParam)
  2808. ON ERROR RESUME NEXT
  2809. Err.Clear
  2810. CONST PROCESSOR_X86_BASED = "X86"
  2811. CONST PROCESSOR_IA64_BASED = "IA64"
  2812. Dim objInstance ' object instance
  2813. Dim intReturnValue ' to store return value
  2814. Dim strProcessorType ' to store the processor type
  2815. Dim strQuery ' to store the query
  2816. Dim objEnum ' collection of objects
  2817. getMaxSizeUB = 0
  2818. strQuery = "Select * From " & CLASS_COMPUTER_SYSTEM
  2819. Set objEnum = objServiceParam.ExecQuery(strQuery,"WQL",48,null)
  2820. If Err.Number Then
  2821. Err.Clear
  2822. WScript.Echo L_UnableToRetrieveInfo_ErrorMessage
  2823. blnFailureMsg = TRUE
  2824. QuitBasedOnSuccess EXIT_QUERY_FAIL
  2825. End If
  2826. ' The following code will handle only single processor environment
  2827. For each objInstance in objEnum
  2828. strProcessorType = objInstance.SystemType
  2829. Next
  2830. ' check if its a 32-bit processor
  2831. If InStr( UCase(strProcessorType),PROCESSOR_X86_BASED ) > 0 Then
  2832. getMaxSizeUB = 4096
  2833. End If
  2834. ' check if its a 64-bit processor
  2835. If Instr( UCase(strProcessorType),PROCESSOR_IA64_BASED ) > 0 Then
  2836. getMaxSizeUB = 33554432
  2837. End If
  2838. End Function
  2839. '******************************************************************************
  2840. '* Function: GetCrashDumpSetting
  2841. '*
  2842. '* Purpose: To get the Crash Dump Settings for the machine specified
  2843. '*
  2844. '* Input:
  2845. '* [in] strUserNameParam user name to connect to the machine
  2846. '* [in] strPasswordParam password for the user
  2847. '* [in] strMachineParam machine to get crash dump settings for
  2848. '*
  2849. '* Output: Returns the current crash dump setting value [ 0,1,2,3 ]
  2850. '* 0 - None
  2851. '* 1 - Complete Memory Dump
  2852. '* 2 - Kernel Memory Dump
  2853. '* 3 - Small Memory Dump
  2854. '*
  2855. '******************************************************************************
  2856. Private Function GetCrashDumpSetting( ByVal strUserNameParam, _
  2857. ByVal strPasswordParam, _
  2858. ByVal strMachineParam )
  2859. ON ERROR RESUME NEXT
  2860. Err.Clear
  2861. CONST CONST_NAMESPACE_DEFAULT = "root\default" ' name space to connect to
  2862. CONST CONST_HKEY_LOCAL_MACHINE = 2147483650 ' registry value for HKEY_LOCAL_MACHINE
  2863. CONST CONST_KEY_VALUE_NAME = "CrashDumpEnabled" ' value name to be retrieved
  2864. CONST CONST_STD_REGISTRY_PROVIDER = "StdRegProv" ' standard registry provider
  2865. ' the Sub Key Name
  2866. CONST CONST_CRASH_DUMP_REGKEY = "SYSTEM\CurrentControlSet\Control\CrashControl"
  2867. Dim objInstance ' to store the object instance
  2868. Dim objService ' service object
  2869. Dim intCrashDumpValue ' to store the crash dump setting value
  2870. Dim intReturnVal ' to store return value
  2871. ' connect to the WMI name space
  2872. If NOT component.wmiConnect(CONST_NAMESPACE_DEFAULT , _
  2873. strUserNameParam , _
  2874. strPasswordParam , _
  2875. strMachineParam , _
  2876. blnLocalConnection , _
  2877. objService ) Then
  2878. WScript.Echo(L_HintCheckConnection_Message)
  2879. blnFailureMsg = TRUE
  2880. QuitBasedOnSuccess EXIT_METHOD_FAIL
  2881. End If
  2882. ' get the instance of the Standard Registry Provider
  2883. Set objInstance = objService.Get(CONST_STD_REGISTRY_PROVIDER)
  2884. ' get the key value for from the registry
  2885. intReturnVal = objInstance.GetDWORDValue( CONST_HKEY_LOCAL_MACHINE, _
  2886. CONST_CRASH_DUMP_REGKEY, _
  2887. CONST_KEY_VALUE_NAME, _
  2888. intCrashDumpValue )
  2889. ' check if any error has occured
  2890. If Err.Number <> 0 Then
  2891. Err.Clear
  2892. WScript.Echo(L_FailCreateObject_ErrorMessage)
  2893. blnFailureMsg = TRUE
  2894. QuitBasedOnSuccess EXIT_INVALID_PARAM
  2895. End If
  2896. ' check for the return value after registry is accessed.
  2897. If intReturnVal = 0 Then
  2898. GetCrashDumpSetting = CInt(intCrashDumpValue)
  2899. Else
  2900. WScript.Echo(L_FailCreateObject_ErrorMessage)
  2901. blnFailureMsg = TRUE
  2902. QuitBasedOnSuccess EXIT_INVALID_PARAM
  2903. End If
  2904. End Function
  2905. ' Function used to get the reply in y/n from the user
  2906. '******************************************************************************
  2907. '* Function: getReply
  2908. '*
  2909. '* Purpose: To get reply from the user
  2910. '*
  2911. '* Input: None
  2912. '*
  2913. '* Output: Prompts for a warning message and accepts the user's choice [y/n]
  2914. '*
  2915. '******************************************************************************
  2916. Private Function getReply()
  2917. ON ERROR RESUME NEXT
  2918. Err.Clear
  2919. Dim objStdIn ' to store value from standard input
  2920. Dim strReply ' to store the user reply
  2921. WScript.Echo(L_PromptForContinueAnyWay_Message)
  2922. Set objStdIn = WScript.StdIn
  2923. If Err.Number Then
  2924. Err.Clear
  2925. WScript.Echo(L_FailCreateObject_ErrorMessage)
  2926. blnFailureMsg = TRUE
  2927. QuitBasedOnSuccess EXIT_INVALID_PARAM
  2928. End If
  2929. strReply = objStdIn.ReadLine()
  2930. getReply = Trim(strReply)
  2931. End Function
  2932. '******************************************************************************
  2933. '* Function: isCrashDumpValueSet
  2934. '*
  2935. '* Purpose: To check if the crash dump value is set
  2936. '*
  2937. '* Input:
  2938. '* [in] intCrashDumpParam crash dump setting value
  2939. '* [in] intIntSizeParam initial size of the pagefile
  2940. '* [in] intMemSizeParam physical memory size
  2941. '* [in] strVolume drive/volume name
  2942. '*
  2943. '* Output: Returns TRUE or FALSE
  2944. '*
  2945. '******************************************************************************
  2946. Private Function isCrashDumpValueSet( ByVal intCrashDumpParam,_
  2947. ByVal intIntSizeParam, _
  2948. ByVal intMemSizeParam, _
  2949. ByVal strVolume )
  2950. ON ERROR RESUME NEXT
  2951. Err.Clear
  2952. ' Constants for Crash Dump Settings
  2953. CONST NO_MEMORY_DUMP = 0
  2954. CONST COMPLETE_MEMORY_DUMP = 1
  2955. CONST KERNEL_MEMORY_DUMP = 2
  2956. CONST SMALL_MEMORY_DUMP = 3
  2957. Dim strReply ' to store user reply
  2958. Dim intSizeValue ' to store the size value used for comparison
  2959. ' default value is NO [n]
  2960. strReply = L_UserReplyNo_Text
  2961. Select Case CInt(intCrashDumpParam)
  2962. Case COMPLETE_MEMORY_DUMP
  2963. If CInt(intIntSizeParam) < CInt(intMemSizeParam) Then
  2964. component.VBPrintf CrashDumpSettingWarningMessage, Array(UCase(strVolume),CInt(intMemSizeParam) & MEGA_BYTES)
  2965. ' Ask for choice until a yes[y] or no[n] is given
  2966. Do
  2967. strReply = getReply()
  2968. If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  2969. isCrashDumpValueSet = TRUE
  2970. ElseIf Trim(LCase(strReply)) = L_UserReplyNo_Text Then
  2971. isCrashDumpValueSet = FALSE
  2972. Else
  2973. WScript.Echo(L_InvalidUserReply_ErrorMessage)
  2974. End If
  2975. Loop Until (Trim(LCase(strReply)) = L_UserReplyYes_Text OR Trim(LCase(strReply)) = L_UserReplyNo_Text)
  2976. Else
  2977. isCrashDumpValueSet = TRUE
  2978. End If
  2979. Case KERNEL_MEMORY_DUMP
  2980. ' check if RAM size is less than or equal to 128 MB
  2981. If CInt(intMemSizeParam) <= 128 Then
  2982. ' assign size value to be checked to 50 MB
  2983. intSizeValue = 50
  2984. Else
  2985. ' check if RAM size is less than or equal to 4 GB
  2986. If CInt(intMemSizeParam) <= 4096 Then
  2987. ' assign size value to be checked to 200 MB
  2988. intSizeValue = 200
  2989. Else
  2990. ' check if RAM size is less than or equal to 8 GB
  2991. If CInt(intMemSizeParam) <= 8192 Then
  2992. ' assign size value to be checked to 400 MB
  2993. intSizeValue = 400
  2994. Else
  2995. ' assign size value to be checked to 800 MB
  2996. intSizeValue = 800
  2997. End If
  2998. End If
  2999. End If
  3000. If CInt(intIntSizeParam) < CInt(intSizeValue) Then
  3001. component.VBPrintf CrashDumpSettingWarningMessage, Array(UCase(strVolume),intSizeValue & MEGA_BYTES)
  3002. ' Ask for choice until a yes[y] or no[n] is given
  3003. Do
  3004. strReply = getReply()
  3005. If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  3006. isCrashDumpValueSet = TRUE
  3007. ElseIf Trim(LCase(strReply)) = L_UserReplyNo_Text Then
  3008. isCrashDumpValueSet = FALSE
  3009. Else
  3010. WScript.Echo(L_InvalidUserReply_ErrorMessage)
  3011. End If
  3012. Loop Until (Trim(LCase(strReply)) = L_UserReplyYes_Text OR Trim(LCase(strReply)) = L_UserReplyNo_Text)
  3013. Else
  3014. isCrashDumpValueSet = TRUE
  3015. End If
  3016. Case SMALL_MEMORY_DUMP
  3017. ' initial size should not be less than 64 KB ( less than or equal to 0 MB )
  3018. If CInt(intIntSizeParam) <= 0 Then
  3019. component.VBPrintf CrashDumpSettingWarningMessage, Array(UCase(strVolume),"64 KB")
  3020. ' Ask for choice until a yes[y] or no[n] is given
  3021. Do
  3022. strReply = getReply()
  3023. If Trim(LCase(strReply)) = L_UserReplyYes_Text Then
  3024. isCrashDumpValueSet = TRUE
  3025. ElseIf Trim(LCase(strReply)) = L_UserReplyNo_Text Then
  3026. isCrashDumpValueSet = FALSE
  3027. Else
  3028. WScript.Echo(L_InvalidUserReply_ErrorMessage)
  3029. End If
  3030. Loop Until (Trim(LCase(strReply)) = L_UserReplyYes_Text OR Trim(LCase(strReply)) = L_UserReplyNo_Text)
  3031. Else
  3032. isCrashDumpValueSet = TRUE
  3033. End If
  3034. Case NO_MEMORY_DUMP
  3035. ' Crash Dump values 0 has no problem
  3036. isCrashDumpValueSet = TRUE
  3037. End Select
  3038. End Function
  3039. '*******************************************************************************
  3040. '* sub: QuitBasedOnSuccess
  3041. '*
  3042. '* purpose: To quit the script based on the partial success of the operations
  3043. '*
  3044. '* Input: intReturnVal - Return value to be returned
  3045. '*
  3046. '******************************************************************************
  3047. sub QuitBasedOnSuccess(Byval intReturnVal )
  3048. ON ERROR RESUME NEXT
  3049. Err.Clear
  3050. ' Prompt for reboot if at least one operation was successful.
  3051. If blnSuccessMsg = TRUE Then
  3052. WScript.Echo L_RestartComputer_Message
  3053. End If
  3054. ' If zero has to be returned, return based on the failure status
  3055. If intReturnVal = EXIT_SUCCESS Then
  3056. If blnFailureMsg = TRUE Then
  3057. Wscript.Quit( EXIT_PARTIAL_SUCCESS )
  3058. Else
  3059. Wscript.Quit( EXIT_SUCCESS )
  3060. End If
  3061. 'If other return levels are to be returned, just chck success value to return partial success value
  3062. Else
  3063. If blnSuccessMsg = TRUE Then
  3064. Wscript.Quit( EXIT_PARTIAL_SUCCESS )
  3065. Else
  3066. Wscript.Quit( intReturnVal)
  3067. End If
  3068. End If
  3069. End sub
  3070. '******************************************************************************
  3071. '* Sub: typeMessage
  3072. '*
  3073. '* Purpose: To print the type usage messages relevent to the main option
  3074. '* selected.
  3075. '*
  3076. '* Input: The main option selected.
  3077. '*
  3078. '* Output: Prints "type..usage" messages for the main option selected.
  3079. '*
  3080. '******************************************************************************
  3081. Sub typeMessage(ByVal intMainOption)
  3082. ON ERROR RESUME NEXT
  3083. Err.Clear
  3084. Select Case CInt(intMainOption)
  3085. Case CONST_CHANGE_OPTION
  3086. component.VBPrintf L_TypeChangeUsage_Message,Array(UCase(WScript.ScriptName))
  3087. Case CONST_CREATE_OPTION
  3088. component.VBPrintf L_TypeCreateUsage_Message,Array(UCase(WScript.ScriptName))
  3089. Case CONST_DELETE_OPTION
  3090. component.VBPrintf L_TypeDeleteUsage_Message,Array(UCase(WScript.ScriptName))
  3091. Case CONST_QUERY_OPTION
  3092. component.VBPrintf L_TypeQueryUsage_Message,Array(UCase(WScript.ScriptName))
  3093. Case Else
  3094. component.VBPrintf L_TypeUsage_Message,Array(UCase(WScript.ScriptName))
  3095. End Select
  3096. End Sub
  3097. '******************************************************************************
  3098. '* Function: ExpandEnvironmentString()
  3099. '*
  3100. '* Purpose: This function expands the environment variables.
  3101. '*
  3102. '* Input: [in] strOriginalString the string that needs expansion.
  3103. '* Output: Returns ExpandedEnvironmentString
  3104. '*
  3105. '******************************************************************************
  3106. Private Function ExpandEnvironmentString(ByVal strOriginalString)
  3107. ON ERROR RESUME NEXT
  3108. Err.Clear
  3109. Dim ObjWshShell ' Object to hold Shell.
  3110. ' Create the shell object.
  3111. Set ObjWshShell = CreateObject("WScript.Shell")
  3112. If Err.Number Then
  3113. WScript.Echo( L_FailCreateObject_ErrorMessage )
  3114. blnFailureMsg = TRUE
  3115. QuitBasedOnSuccess EXIT_METHOD_FAIL
  3116. End If
  3117. ' Return the string.
  3118. ExpandEnvironmentString = ObjWshShell.ExpandEnvironmentStrings(strOriginalString)
  3119. End Function
  3120. '******************************************************************************
  3121. '* Sub: ShowUsage
  3122. '*
  3123. '* Purpose: Shows the correct usage to the user.
  3124. '*
  3125. '* Input: None
  3126. '*
  3127. '* Output: Help messages are displayed on screen.
  3128. '*
  3129. '******************************************************************************
  3130. Sub ShowUsage()
  3131. WScript.Echo vbCr ' Line 1
  3132. WScript.Echo( L_ShowUsageLine02_Text ) ' Line 2
  3133. WScript.Echo vbCr ' Line 3
  3134. WScript.Echo( L_UsageDescription_Text ) ' Line 4
  3135. WScript.Echo( L_ShowUsageLine05_Text ) ' Line 5
  3136. WScript.Echo( L_ShowUsageLine06_Text ) ' Line 6
  3137. WScript.Echo vbCr ' Line 7
  3138. WScript.Echo( L_ShowUsageLine08_Text ) ' Line 8
  3139. WScript.Echo( L_ShowUsageLine09_Text ) ' Line 9
  3140. WScript.Echo( L_ShowUsageLine10_Text ) ' Line 10
  3141. WScript.Echo vbCr ' Line 11
  3142. WScript.Echo( L_ShowUsageLine12_Text ) ' Line 12
  3143. WScript.Echo vbCr ' Line 13
  3144. WScript.Echo( L_ShowUsageLine14_Text ) ' Line 14
  3145. WScript.Echo vbCr ' Line 15
  3146. WScript.Echo( L_ShowUsageLine16_Text ) ' Line 16
  3147. WScript.Echo( L_ShowUsageLine17_Text ) ' Line 17
  3148. WScript.Echo vbCr ' Line 18
  3149. WScript.Echo( L_ShowUsageLine19_Text ) ' Line 19
  3150. WScript.Echo( L_ShowUsageLine20_Text ) ' Line 20
  3151. WScript.Echo( L_ShowUsageLine21_Text ) ' Line 21
  3152. WScript.Echo( L_ShowUsageLine22_Text ) ' Line 22
  3153. WScript.Echo( L_ShowUsageLine23_Text ) ' Line 23
  3154. WScript.Echo( L_ShowUsageLine24_Text ) ' Line 24
  3155. WScript.Echo( L_ShowUsageLine25_Text ) ' Line 25
  3156. End Sub
  3157. '******************************************************************************
  3158. '* Sub: ShowChangeUsage
  3159. '*
  3160. '* Purpose: Shows the correct usage to the user.
  3161. '*
  3162. '* Input: None
  3163. '*
  3164. '* Output: Help messages for the /Change o ption are displayed on screen.
  3165. '*
  3166. '******************************************************************************
  3167. Sub ShowChangeUsage()
  3168. WScript.Echo vbCr ' Line 1
  3169. WScript.Echo( L_ShowChangeUsageLine02_Text ) ' Line 2
  3170. WScript.Echo( L_ShowChangeUsageLine03_Text ) ' Line 3
  3171. WScript.Echo( L_ShowChangeUsageLine04_Text ) ' Line 4
  3172. WScript.Echo vbCr ' Line 5
  3173. WScript.Echo( L_UsageDescription_Text ) ' Line 6
  3174. WScript.Echo( L_ShowChangeUsageLine07_Text ) ' Line 7
  3175. WScript.Echo vbCr ' Line 8
  3176. WScript.Echo( L_UsageParamList_Text ) ' Line 9
  3177. WScript.Echo( L_UsageMachineName_Text ) ' Line 10
  3178. WScript.Echo vbCr ' Line 11
  3179. WScript.Echo( L_UsageUserNameLine1_Text ) ' Line 12
  3180. WScript.Echo( L_UsageUserNameLine2_Text ) ' Line 13
  3181. WScript.Echo vbCr ' Line 14
  3182. WScript.Echo( L_UsagePasswordLine1_Text ) ' Line 15
  3183. WScript.Echo( L_UsagePasswordLine2_Text ) ' Line 16
  3184. WScript.Echo vbCr ' Line 17
  3185. WScript.Echo( L_ShowChangeUsageLine18_Text ) ' Line 18
  3186. WScript.Echo( L_ShowChangeUsageLine19_Text ) ' Line 19
  3187. WScript.Echo vbCr ' Line 20
  3188. WScript.Echo( L_ShowChangeUsageLine21_Text ) ' Line 21
  3189. WScript.Echo( L_ShowChangeUsageLine22_Text ) ' Line 22
  3190. WScript.Echo vbCr ' Line 23
  3191. WScript.Echo( L_ShowChangeUsageLine24_Text ) ' Line 24
  3192. WScript.Echo( L_ShowChangeUsageLine25_Text ) ' Line 25
  3193. WScript.Echo vbCr ' Line 26
  3194. WScript.Echo( L_ShowChangeUsageLine27_Text ) ' Line 27
  3195. WScript.Echo( L_ShowChangeUsageLine28_Text ) ' Line 28
  3196. WScript.Echo( L_ShowChangeUsageLine29_Text ) ' Line 29
  3197. WScript.Echo( L_ShowChangeUsageLine30_Text ) ' Line 30
  3198. WScript.Echo vbCr ' Line 31
  3199. WScript.Echo( L_UsageExamples_Text ) ' Line 31
  3200. WScript.Echo( L_ShowChangeUsageLine33_Text ) ' Line 33
  3201. WScript.Echo( L_ShowChangeUsageLine34_Text ) ' Line 34
  3202. WScript.Echo( L_ShowChangeUsageLine35_Text ) ' Line 35
  3203. WScript.Echo( L_ShowChangeUsageLine36_Text ) ' Line 36
  3204. WScript.Echo( L_ShowChangeUsageLine37_Text ) ' Line 37
  3205. WScript.Echo( L_ShowChangeUsageLine38_Text ) ' Line 38
  3206. WScript.Echo( L_ShowChangeUsageLine39_Text ) ' Line 39
  3207. End Sub
  3208. '******************************************************************************
  3209. '* Sub: ShowCreateUsage
  3210. '*
  3211. '* Purpose: Shows the correct usage to the user.
  3212. '*
  3213. '* Input: None
  3214. '*
  3215. '* Output: Help messages for the /Create option are displayed on screen.
  3216. '*
  3217. '******************************************************************************
  3218. Sub ShowCreateUsage()
  3219. WScript.Echo vbCr ' Line 1
  3220. WScript.Echo( L_ShowCreateUsageLine02_Text ) ' Line 2
  3221. WScript.Echo( L_ShowCreateUsageLine03_Text ) ' Line 3
  3222. WScript.Echo( L_ShowCreateUsageLine04_Text ) ' Line 4
  3223. WScript.Echo vbCr ' Line 5
  3224. WScript.Echo( L_UsageDescription_Text ) ' Line 6
  3225. WScript.Echo( L_ShowCreateUsageLine07_Text ) ' Line 7
  3226. WScript.Echo vbCr ' Line 8
  3227. WScript.Echo( L_UsageParamList_Text ) ' Line 9
  3228. WScript.Echo( L_UsageMachineName_Text ) ' Line 10
  3229. WScript.Echo vbCr ' Line 11
  3230. WScript.Echo( L_UsageUserNameLine1_Text ) ' Line 12
  3231. WScript.Echo( L_UsageUserNameLine2_Text ) ' Line 13
  3232. WScript.Echo vbCr ' Line 14
  3233. WScript.Echo( L_UsagePasswordLine1_Text ) ' Line 15
  3234. WScript.Echo( L_UsagePasswordLine2_Text ) ' Line 16
  3235. WScript.Echo vbCr ' Line 17
  3236. WScript.Echo( L_ShowCreateUsageLine18_Text ) ' Line 18
  3237. WScript.Echo( L_ShowCreateUsageLine19_Text ) ' Line 19
  3238. WScript.Echo vbCr ' Line 20
  3239. WScript.Echo( L_ShowCreateUsageLine21_Text ) ' Line 21
  3240. WScript.Echo( L_ShowCreateUsageLine22_Text ) ' Line 22
  3241. WScript.Echo vbCr ' Line 23
  3242. WScript.Echo( L_ShowCreateUsageLine24_Text ) ' Line 24
  3243. WScript.Echo( L_ShowCreateUsageLine25_Text ) ' Line 25
  3244. WScript.Echo vbCr ' Line 26
  3245. WScript.Echo( L_ShowCreateUsageLine27_Text ) ' Line 27
  3246. WScript.Echo( L_ShowCreateUsageLine28_Text ) ' Line 28
  3247. WScript.Echo( L_ShowCreateUsageLine29_Text ) ' Line 29
  3248. WScript.Echo( L_ShowCreateUsageLine30_Text ) ' Line 30
  3249. WScript.Echo vbCr ' Line 31
  3250. WScript.Echo( L_UsageExamples_Text ) ' Line 32
  3251. WScript.Echo( L_ShowCreateUsageLine33_Text ) ' Line 33
  3252. WScript.Echo( L_ShowCreateUsageLine34_Text ) ' Line 34
  3253. WScript.Echo( L_ShowCreateUsageLine35_Text ) ' Line 35
  3254. WScript.Echo( L_ShowCreateUsageLine36_Text ) ' Line 36
  3255. WScript.Echo( L_ShowCreateUsageLine37_Text ) ' Line 37
  3256. WScript.Echo( L_ShowCreateUsageLine38_Text ) ' Line 38
  3257. WScript.Echo( L_ShowCreateUsageLine39_Text ) ' Line 39
  3258. End Sub
  3259. '******************************************************************************
  3260. '* Sub: ShowDeleteUsage
  3261. '*
  3262. '* Purpose: Shows the correct usage to the user.
  3263. '*
  3264. '* Input: None
  3265. '*
  3266. '* Output: Help messages for the /Delete option are displayed on screen.
  3267. '*
  3268. '******************************************************************************
  3269. Sub ShowDeleteUsage()
  3270. WScript.Echo vbCr ' Line 1
  3271. WScript.Echo( L_ShowDeleteUsageLine02_Text ) ' Line 2
  3272. WScript.Echo( L_ShowDeleteUsageLine03_Text ) ' Line 3
  3273. WScript.Echo vbCr ' Line 4
  3274. WScript.Echo( L_UsageDescription_Text ) ' Line 5
  3275. WScript.Echo( L_ShowDeleteUsageLine06_Text ) ' Line 6
  3276. WScript.Echo vbCr ' Line 7
  3277. WScript.Echo( L_UsageParamList_Text ) ' Line 8
  3278. WScript.Echo( L_UsageMachineName_Text ) ' Line 9
  3279. WScript.Echo vbCr ' Line 10
  3280. WScript.Echo( L_UsageUserNameLine1_Text ) ' Line 11
  3281. WScript.Echo( L_UsageUserNameLine2_Text ) ' Line 12
  3282. WScript.Echo vbCr ' Line 13
  3283. WScript.Echo( L_UsagePasswordLine1_Text ) ' Line 14
  3284. WScript.Echo( L_UsagePasswordLine2_Text ) ' Line 15
  3285. WScript.Echo vbCr ' Line 16
  3286. WScript.Echo( L_ShowDeleteUsageLine17_Text ) ' Line 17
  3287. WScript.Echo( L_ShowDeleteUsageLine18_Text ) ' Line 18
  3288. WScript.Echo( L_ShowDeleteUsageLine19_Text ) ' Line 19
  3289. WScript.Echo vbCr ' Line 20
  3290. WScript.Echo( L_UsageExamples_Text ) ' Line 21
  3291. WScript.Echo( L_ShowDeleteUsageLine22_Text ) ' Line 22
  3292. WScript.Echo( L_ShowDeleteUsageLine23_Text ) ' Line 23
  3293. WScript.Echo( L_ShowDeleteUsageLine24_Text ) ' Line 24
  3294. WScript.Echo( L_ShowDeleteUsageLine25_Text ) ' Line 25
  3295. End Sub
  3296. '******************************************************************************
  3297. '* Sub: ShowQueryUsage
  3298. '*
  3299. '* Purpose: Shows the correct usage to the user.
  3300. '*
  3301. '* Input: None
  3302. '*
  3303. '* Output: Help messages for the /Query option are displayed on screen.
  3304. '*
  3305. '******************************************************************************
  3306. Sub ShowQueryUsage()
  3307. WScript.Echo vbCr ' Line 1
  3308. WScript.Echo( L_ShowQueryUsageLine02_Text ) ' Line 2
  3309. WScript.Echo( L_ShowQueryUsageLine03_Text ) ' Line 3
  3310. WScript.Echo vbCr ' Line 4
  3311. WScript.Echo( L_UsageDescription_Text ) ' Line 5
  3312. WScript.Echo( L_ShowQueryUsageLine06_Text ) ' Line 6
  3313. WScript.Echo vbCr ' Line 7
  3314. WScript.Echo( L_UsageParamList_Text ) ' Line 8
  3315. WScript.Echo( L_UsageMachineName_Text ) ' Line 9
  3316. WScript.Echo vbCr ' Line 10
  3317. WScript.Echo( L_UsageUserNameLine1_Text ) ' Line 11
  3318. WScript.Echo( L_UsageUserNameLine2_Text ) ' Line 12
  3319. WScript.Echo vbCr ' Line 13
  3320. WScript.Echo( L_UsagePasswordLine1_Text ) ' Line 14
  3321. WScript.Echo( L_UsagePasswordLine2_Text ) ' Line 15
  3322. WScript.Echo vbCr ' Line 16
  3323. WScript.Echo( L_ShowQueryUsageLine17_Text ) ' Line 17
  3324. WScript.Echo( L_ShowQueryUsageLine18_Text ) ' Line 18
  3325. WScript.Echo( L_ShowQueryUsageLine19_Text ) ' Line 19
  3326. WScript.Echo vbCr ' Line 20
  3327. WScript.Echo( L_ShowQueryUsageLine21_Text ) ' Line 21
  3328. WScript.Echo( L_ShowQueryUsageLine22_Text ) ' Line 22
  3329. WScript.Echo vbCr ' Line 23
  3330. WScript.Echo( L_UsageExamples_Text ) ' Line 24
  3331. WScript.Echo( L_ShowQueryUsageLine25_Text ) ' Line 25
  3332. WScript.Echo( L_ShowQueryUsageLine26_Text ) ' Line 26
  3333. WScript.Echo( L_ShowQueryUsageLine27_Text ) ' Line 27
  3334. WScript.Echo( L_ShowQueryUsageLine28_Text ) ' Line 28
  3335. WScript.Echo( L_ShowQueryUsageLine29_Text ) ' Line 29
  3336. WScript.Echo( L_ShowQueryUsageLine30_Text ) ' Line 30
  3337. WScript.Echo( L_ShowQueryUsageLine31_Text ) ' Line 31
  3338. End Sub
  3339. '' SIG '' Begin signature block
  3340. '' SIG '' MIIaLwYJKoZIhvcNAQcCoIIaIDCCGhwCAQExDjAMBggq
  3341. '' SIG '' hkiG9w0CBQUAMGYGCisGAQQBgjcCAQSgWDBWMDIGCisG
  3342. '' SIG '' AQQBgjcCAR4wJAIBAQQQTvApFpkntU2P5azhDxfrqwIB
  3343. '' SIG '' AAIBAAIBAAIBAAIBADAgMAwGCCqGSIb3DQIFBQAEEHko
  3344. '' SIG '' YVpKucLx6zWsK5hurrSgghS8MIICvDCCAiUCEEoZ0jiM
  3345. '' SIG '' glkcpV1zXxVd3KMwDQYJKoZIhvcNAQEEBQAwgZ4xHzAd
  3346. '' SIG '' BgNVBAoTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxFzAV
  3347. '' SIG '' BgNVBAsTDlZlcmlTaWduLCBJbmMuMSwwKgYDVQQLEyNW
  3348. '' SIG '' ZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZpY2UgUm9v
  3349. '' SIG '' dDE0MDIGA1UECxMrTk8gTElBQklMSVRZIEFDQ0VQVEVE
  3350. '' SIG '' LCAoYyk5NyBWZXJpU2lnbiwgSW5jLjAeFw05NzA1MTIw
  3351. '' SIG '' MDAwMDBaFw0wNDAxMDcyMzU5NTlaMIGeMR8wHQYDVQQK
  3352. '' SIG '' ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMRcwFQYDVQQL
  3353. '' SIG '' Ew5WZXJpU2lnbiwgSW5jLjEsMCoGA1UECxMjVmVyaVNp
  3354. '' SIG '' Z24gVGltZSBTdGFtcGluZyBTZXJ2aWNlIFJvb3QxNDAy
  3355. '' SIG '' BgNVBAsTK05PIExJQUJJTElUWSBBQ0NFUFRFRCwgKGMp
  3356. '' SIG '' OTcgVmVyaVNpZ24sIEluYy4wgZ8wDQYJKoZIhvcNAQEB
  3357. '' SIG '' BQADgY0AMIGJAoGBANMuIPBofCwtLoEcsQaypwu3EQ1X
  3358. '' SIG '' 2lPYdePJMyqy1PYJWzTz6ZD+CQzQ2xtauc3n9oixncCH
  3359. '' SIG '' Jet9WBBzanjLcRX9xlj2KatYXpYE/S1iEViBHMpxlNUi
  3360. '' SIG '' WC/VzBQFhDa6lKq0TUrp7jsirVaZfiGcbIbASkeXarSm
  3361. '' SIG '' NtX8CS3TtDmbAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEA
  3362. '' SIG '' YVUOPnvHkhJ+ERCOIszUsxMrW+hE5At4nqR+86cHch7i
  3363. '' SIG '' We/MhOOJlEzbTmHvs6T7Rj1QNAufcFb2jip/F87lY795
  3364. '' SIG '' aQdzLrCVKIr17aqp0l3NCsoQCY/Os68olsR5KYSS3P+6
  3365. '' SIG '' Z0JIppAQ5L9h+JxT5ZPRcz/4/Z1PhKxV0f0RY2MwggQC
  3366. '' SIG '' MIIDa6ADAgECAhAIem1cb2KTT7rE/UPhFBidMA0GCSqG
  3367. '' SIG '' SIb3DQEBBAUAMIGeMR8wHQYDVQQKExZWZXJpU2lnbiBU
  3368. '' SIG '' cnVzdCBOZXR3b3JrMRcwFQYDVQQLEw5WZXJpU2lnbiwg
  3369. '' SIG '' SW5jLjEsMCoGA1UECxMjVmVyaVNpZ24gVGltZSBTdGFt
  3370. '' SIG '' cGluZyBTZXJ2aWNlIFJvb3QxNDAyBgNVBAsTK05PIExJ
  3371. '' SIG '' QUJJTElUWSBBQ0NFUFRFRCwgKGMpOTcgVmVyaVNpZ24s
  3372. '' SIG '' IEluYy4wHhcNMDEwMjI4MDAwMDAwWhcNMDQwMTA2MjM1
  3373. '' SIG '' OTU5WjCBoDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4x
  3374. '' SIG '' HzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsx
  3375. '' SIG '' OzA5BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczov
  3376. '' SIG '' L3d3dy52ZXJpc2lnbi5jb20vcnBhIChjKTAxMScwJQYD
  3377. '' SIG '' VQQDEx5WZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZp
  3378. '' SIG '' Y2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
  3379. '' SIG '' AQDAemGH67KnA2MbKxph3oC3FR2gi5A9uyeShBQ564XO
  3380. '' SIG '' KZIGZkikA0+N6E+n8K9e0S8Zx5HxtZ57kSHO6f/jTvD8
  3381. '' SIG '' r5VYuGMt5o72KRjNcI5Qw+2Wu0DbviXoQlXW9oXyBueL
  3382. '' SIG '' mRwx8wMP1EycJCrcGxuPgvOw76dN4xSn4I/Wx2jCYVip
  3383. '' SIG '' ctT4MEhP2S9vYyDZicqCe8JLvCjFgWjn5oJArEY6oPk/
  3384. '' SIG '' Ns1Mu1RCWnple/6E5MdHVKy5PeyAxxr3xDOBgckqlft/
  3385. '' SIG '' XjqHkBTbzC518u9r5j2pYL5CAapPqluoPyIxnxIV+XOh
  3386. '' SIG '' HoKLBCvqRgJMbY8fUC6VSyp4BoR0PZGPLEcxAgMBAAGj
  3387. '' SIG '' gbgwgbUwQAYIKwYBBQUHAQEENDAyMDAGCCsGAQUFBzAB
  3388. '' SIG '' hiRodHRwOi8vb2NzcC52ZXJpc2lnbi5jb20vb2NzcC9z
  3389. '' SIG '' dGF0dXMwCQYDVR0TBAIwADBEBgNVHSAEPTA7MDkGC2CG
  3390. '' SIG '' SAGG+EUBBwEBMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8v
  3391. '' SIG '' d3d3LnZlcmlzaWduLmNvbS9ycGEwEwYDVR0lBAwwCgYI
  3392. '' SIG '' KwYBBQUHAwgwCwYDVR0PBAQDAgbAMA0GCSqGSIb3DQEB
  3393. '' SIG '' BAUAA4GBAC3zT2NgLBja9SQPUrMM67O8Z4XCI+2PRg3P
  3394. '' SIG '' Gk2+83x6IDAyGGiLkrsymfCTuDsVBid7PgIGAKQhkoQT
  3395. '' SIG '' CsWY5UBXxQUl6K+vEWqp5TvL6SP2lCldQFXzpVOdyDY6
  3396. '' SIG '' OWUIc3OkMtKvrL/HBTz/RezD6Nok0c5jrgmn++Ib4/1B
  3397. '' SIG '' CmqWMIIEEjCCAvqgAwIBAgIPAMEAizw8iBHRPvZj7N9A
  3398. '' SIG '' MA0GCSqGSIb3DQEBBAUAMHAxKzApBgNVBAsTIkNvcHly
  3399. '' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
  3400. '' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
  3401. '' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5MB4X
  3402. '' SIG '' DTk3MDExMDA3MDAwMFoXDTIwMTIzMTA3MDAwMFowcDEr
  3403. '' SIG '' MCkGA1UECxMiQ29weXJpZ2h0IChjKSAxOTk3IE1pY3Jv
  3404. '' SIG '' c29mdCBDb3JwLjEeMBwGA1UECxMVTWljcm9zb2Z0IENv
  3405. '' SIG '' cnBvcmF0aW9uMSEwHwYDVQQDExhNaWNyb3NvZnQgUm9v
  3406. '' SIG '' dCBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  3407. '' SIG '' DwAwggEKAoIBAQCpAr3BcOY78k4bKJ+XeF4w6qKpjSVf
  3408. '' SIG '' +P6VTKO3/p2iID58UaKboo9gMmvRQmR57qx2yVTa8uuc
  3409. '' SIG '' hhyPn4Rms8VremIj1h083g8BkuiWxL8tZpqaaCaZ0Dos
  3410. '' SIG '' vwy1WCbBRucKPjiWLKkoOajsSYNC44QPu5psVWGsgnyh
  3411. '' SIG '' YC13TOmZtGQ7mlAcMQgkFJ+p55ErGOY9mGMUYFgFZZ8d
  3412. '' SIG '' N1KH96fvlALGG9O/VUWziYC/OuxUlE6u/ad6bXROrxjM
  3413. '' SIG '' lgkoIQBXkGBpN7tLEgc8Vv9b+6RmCgim0oFWV++2O14W
  3414. '' SIG '' gXcE2va+roCV/rDNf9anGnJcPMq88AijIjCzBoXJsyB3
  3415. '' SIG '' E4XfAgMBAAGjgagwgaUwgaIGA1UdAQSBmjCBl4AQW9Bw
  3416. '' SIG '' 72lyniNRfhSyTY7/y6FyMHAxKzApBgNVBAsTIkNvcHly
  3417. '' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
  3418. '' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
  3419. '' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5gg8A
  3420. '' SIG '' wQCLPDyIEdE+9mPs30AwDQYJKoZIhvcNAQEEBQADggEB
  3421. '' SIG '' AJXoC8CN85cYNe24ASTYdxHzXGAyn54Lyz4FkYiPyTrm
  3422. '' SIG '' IfLwV5MstaBHyGLv/NfMOztaqTZUaf4kbT/JzKreBXzd
  3423. '' SIG '' MY09nxBwarv+Ek8YacD80EPjEVogT+pie6+qGcgrNyUt
  3424. '' SIG '' vmWhEoolD2Oj91Qc+SHJ1hXzUqxuQzIH/YIX+OVnbA1R
  3425. '' SIG '' 9r3xUse958Qw/CAxCYgdlSkaTdUdAqXxgOADtFv0sd3I
  3426. '' SIG '' V+5lScdSVLa0AygS/5DW8AiPfriXxas3LOR65Kh343ag
  3427. '' SIG '' ANBqP8HSNorgQRKoNWobats14dQcBOSoRQTIWjM4bk0c
  3428. '' SIG '' DWK3CqKM09VUP0bNHFWmcNsSOoeTdZ+n0qAwggTJMIID
  3429. '' SIG '' saADAgECAhBqC5lPwADeqhHU2ECaqL7mMA0GCSqGSIb3
  3430. '' SIG '' DQEBBAUAMHAxKzApBgNVBAsTIkNvcHlyaWdodCAoYykg
  3431. '' SIG '' MTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAcBgNVBAsTFU1p
  3432. '' SIG '' Y3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWlj
  3433. '' SIG '' cm9zb2Z0IFJvb3QgQXV0aG9yaXR5MB4XDTAwMTIxMDA4
  3434. '' SIG '' MDAwMFoXDTA1MTExMjA4MDAwMFowgaYxCzAJBgNVBAYT
  3435. '' SIG '' AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH
  3436. '' SIG '' EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y
  3437. '' SIG '' cG9yYXRpb24xKzApBgNVBAsTIkNvcHlyaWdodCAoYykg
  3438. '' SIG '' MjAwMCBNaWNyb3NvZnQgQ29ycC4xIzAhBgNVBAMTGk1p
  3439. '' SIG '' Y3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBMIIBIDANBgkq
  3440. '' SIG '' hkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEAooQVU9gLMA40
  3441. '' SIG '' lf86G8LzL3ttNyNN89KM5f2v/cUCNB8kx+Wh3FTsfgJ0
  3442. '' SIG '' R6vbMlgWFFEpOPF+srSMOke1OU5uVMIxDDpt+83Ny1Cc
  3443. '' SIG '' G66n2NlKJj+1xcuPluJJ8m3Y6ZY+3gXP8KZVN60vYM2A
  3444. '' SIG '' YUKhSVRKDxi3S9mTmTBaR3VktNO73barDJ1PuHM7GDqq
  3445. '' SIG '' tIeMsIiwTU8fThG1M4DfDTpkb0THNL1Kk5u8ph35BSNO
  3446. '' SIG '' YCmPzCryhJqZrajbCnB71jRBkKW3ZsdcGx2jMw6bVAMa
  3447. '' SIG '' P5iQuMznPQR0QxyP9znms6xIemsqDmIBYTl2bv0+mAdL
  3448. '' SIG '' FPEBRv0VAOBH2k/kBeSAJQIBA6OCASgwggEkMBMGA1Ud
  3449. '' SIG '' JQQMMAoGCCsGAQUFBwMDMIGiBgNVHQEEgZowgZeAEFvQ
  3450. '' SIG '' cO9pcp4jUX4Usk2O/8uhcjBwMSswKQYDVQQLEyJDb3B5
  3451. '' SIG '' cmlnaHQgKGMpIDE5OTcgTWljcm9zb2Z0IENvcnAuMR4w
  3452. '' SIG '' HAYDVQQLExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xITAf
  3453. '' SIG '' BgNVBAMTGE1pY3Jvc29mdCBSb290IEF1dGhvcml0eYIP
  3454. '' SIG '' AMEAizw8iBHRPvZj7N9AMBAGCSsGAQQBgjcVAQQDAgEA
  3455. '' SIG '' MB0GA1UdDgQWBBQpXLkbts0z7rueWX335couxA00KDAZ
  3456. '' SIG '' BgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8E
  3457. '' SIG '' BAMCAUYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B
  3458. '' SIG '' AQQFAAOCAQEARVjimkF//J2/SHd3rozZ5hnFV7QavbS5
  3459. '' SIG '' XwKhRWo5Wfm5J5wtTZ78ouQ4ijhkIkLfuS8qz7fWBsrr
  3460. '' SIG '' Kr/gGoV821EIPfQi09TAbYiBFURfZINkxKmULIrbkDdK
  3461. '' SIG '' D7fo1GGPdnbh2SX/JISVjQRWVJShHDo+grzupYeMHIxL
  3462. '' SIG '' eV+1SfpeMmk6H1StdU3fZOcwPNtkSUT7+8QcQnHmoD1F
  3463. '' SIG '' 7msAn6xCvboRs1bk+9WiKoHYH06iVb4nj3Cmomwb/1SK
  3464. '' SIG '' gryBS6ahsWZ6qRenywbAR+ums+kxFVM9KgS//3NI3Isn
  3465. '' SIG '' Q/xj6O4kh1u+NtHoMfUy2V7feXq6MKxphkr7jBG/G41U
  3466. '' SIG '' WTCCBQ8wggP3oAMCAQICCmEHEUMAAAAAADQwDQYJKoZI
  3467. '' SIG '' hvcNAQEFBQAwgaYxCzAJBgNVBAYTAlVTMRMwEQYDVQQI
  3468. '' SIG '' EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4w
  3469. '' SIG '' HAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKzAp
  3470. '' SIG '' BgNVBAsTIkNvcHlyaWdodCAoYykgMjAwMCBNaWNyb3Nv
  3471. '' SIG '' ZnQgQ29ycC4xIzAhBgNVBAMTGk1pY3Jvc29mdCBDb2Rl
  3472. '' SIG '' IFNpZ25pbmcgUENBMB4XDTAyMDUyNTAwNTU0OFoXDTAz
  3473. '' SIG '' MTEyNTAxMDU0OFowgaExCzAJBgNVBAYTAlVTMRMwEQYD
  3474. '' SIG '' VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k
  3475. '' SIG '' MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x
  3476. '' SIG '' KzApBgNVBAsTIkNvcHlyaWdodCAoYykgMjAwMiBNaWNy
  3477. '' SIG '' b3NvZnQgQ29ycC4xHjAcBgNVBAMTFU1pY3Jvc29mdCBD
  3478. '' SIG '' b3Jwb3JhdGlvbjCCASIwDQYJKoZIhvcNAQEBBQADggEP
  3479. '' SIG '' ADCCAQoCggEBAKqZvTmoGCf0Kz0LTD98dy6ny7XRjA3C
  3480. '' SIG '' OnTXk7XgoEs/WV7ORU+aeSnxScwaR+5Vwgg+EiD4VfLu
  3481. '' SIG '' X9Pgypa8MN7+WMgnMtCFVOjwkRC78yu+GeUDmwuGHfOw
  3482. '' SIG '' OYy4/QsdPHMmrFcryimiFZCCFeJ3o0BSA4udwnC6H+k0
  3483. '' SIG '' 9vM1kk5Vg/jaMLYg3lcGtVpCBt5Zy/Lfpr0VR3EZJSPS
  3484. '' SIG '' y2+bGXnfalvxdgV5KfzDVsqPRAiFVYrLyA9GS1XLjJZ3
  3485. '' SIG '' SofoqUEGx/8N6WhXY3LDaVe0Q88yOjDcG+nVQyYqef6V
  3486. '' SIG '' 2yJnJMkv0DTj5vtRSYa4PNAlX9bsngNhh6loQMf44gPm
  3487. '' SIG '' zwUCAwEAAaOCAUAwggE8MA4GA1UdDwEB/wQEAwIGwDAT
  3488. '' SIG '' BgNVHSUEDDAKBggrBgEFBQcDAzAdBgNVHQ4EFgQUa8jG
  3489. '' SIG '' USDwtC/ToLauf14msriHUikwgakGA1UdIwSBoTCBnoAU
  3490. '' SIG '' KVy5G7bNM+67nll99+XKLsQNNCihdKRyMHAxKzApBgNV
  3491. '' SIG '' BAsTIkNvcHlyaWdodCAoYykgMTk5NyBNaWNyb3NvZnQg
  3492. '' SIG '' Q29ycC4xHjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3Jh
  3493. '' SIG '' dGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0
  3494. '' SIG '' aG9yaXR5ghBqC5lPwADeqhHU2ECaqL7mMEoGA1UdHwRD
  3495. '' SIG '' MEEwP6A9oDuGOWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNv
  3496. '' SIG '' bS9wa2kvY3JsL3Byb2R1Y3RzL0NvZGVTaWduUENBLmNy
  3497. '' SIG '' bDANBgkqhkiG9w0BAQUFAAOCAQEANSP9E1T86dzw3QwU
  3498. '' SIG '' evqns879pzrIuuXn9gP7U9unmamgmzacA+uCRxwhvRTL
  3499. '' SIG '' 52dACccWkQJVzkNCtM0bXbDzMgQ9EuUdpwenj6N+RVV2
  3500. '' SIG '' G5aVkWnw3TjzSInvcEC327VVgMADxC62KNwKgg7HQ+N6
  3501. '' SIG '' SF24BomSQGxuxdz4mu8LviEKjC86te2nznGHaCPhs+QY
  3502. '' SIG '' fbhHAaUrxFjLsolsX/3TLMRvuCOyDf888hFFdPIJBpkY
  3503. '' SIG '' 3W/AhgEYEh0rFq9W72UzoepnTvRLgqvpD9wB+t9gf2ZH
  3504. '' SIG '' XcsscMx7TtkGuG6MDP5iHkL5k3yiqwqe0CMQrk17J5Fv
  3505. '' SIG '' Jr5o+qY/nyPryJ27hzGCBN0wggTZAgEBMIG1MIGmMQsw
  3506. '' SIG '' CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ
  3507. '' SIG '' MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z
  3508. '' SIG '' b2Z0IENvcnBvcmF0aW9uMSswKQYDVQQLEyJDb3B5cmln
  3509. '' SIG '' aHQgKGMpIDIwMDAgTWljcm9zb2Z0IENvcnAuMSMwIQYD
  3510. '' SIG '' VQQDExpNaWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQQIK
  3511. '' SIG '' YQcRQwAAAAAANDAMBggqhkiG9w0CBQUAoIGqMBkGCSqG
  3512. '' SIG '' SIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcC
  3513. '' SIG '' AQsxDjAMBgorBgEEAYI3AgEVMB8GCSqGSIb3DQEJBDES
  3514. '' SIG '' BBAZBnnYm2gRb/lDE2fqJ+IWME4GCisGAQQBgjcCAQwx
  3515. '' SIG '' QDA+oCaAJABwAGEAZwBlAGYAaQBsAGUAYwBvAG4AZgBp
  3516. '' SIG '' AGcALgB2AGIAc6EUgBJ3d3cubWljcm9zb2Z0LmNvbSAw
  3517. '' SIG '' DQYJKoZIhvcNAQEBBQAEggEAVrY7HUIi4Emzwy+RpCJA
  3518. '' SIG '' pVRYEi7yH9RDTWX+kPe/wdJpJpae9X7j4wU+C2oIywCF
  3519. '' SIG '' wCqxcE1HwYJu5MR4DV6EAcXJHs/eEuqU2qeMJh1zOmvy
  3520. '' SIG '' vFbVgTpsFcGSMOXvTRXjeTHSQFGfuP1FhU90ENIYrK/k
  3521. '' SIG '' RXUPH16d6rGQ8nBQUGi8uxzLOA94YXGfufMznaTCe6/z
  3522. '' SIG '' WLFioxEv9lpbaxIcnQjKXHCsnQLM557p1wGtb6/TtZuN
  3523. '' SIG '' veQbz6fcgJOZxLIk1B9Ffy90sO+YAvK6vgValTEZ1EFV
  3524. '' SIG '' lPBP13vTgdFH9ALo4BSeDKOHn8pxf3zW3+ZFJNQPRl7A
  3525. '' SIG '' o0fXKB0T5ni10KGCAkwwggJIBgkqhkiG9w0BCQYxggI5
  3526. '' SIG '' MIICNQIBATCBszCBnjEfMB0GA1UEChMWVmVyaVNpZ24g
  3527. '' SIG '' VHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVyaVNpZ24s
  3528. '' SIG '' IEluYy4xLDAqBgNVBAsTI1ZlcmlTaWduIFRpbWUgU3Rh
  3529. '' SIG '' bXBpbmcgU2VydmljZSBSb290MTQwMgYDVQQLEytOTyBM
  3530. '' SIG '' SUFCSUxJVFkgQUNDRVBURUQsIChjKTk3IFZlcmlTaWdu
  3531. '' SIG '' LCBJbmMuAhAIem1cb2KTT7rE/UPhFBidMAwGCCqGSIb3
  3532. '' SIG '' DQIFBQCgWTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB
  3533. '' SIG '' MBwGCSqGSIb3DQEJBTEPFw0wMjEwMzAwMDE1NDdaMB8G
  3534. '' SIG '' CSqGSIb3DQEJBDESBBAeS2yNHwLSVyiXAZeQB+I2MA0G
  3535. '' SIG '' CSqGSIb3DQEBAQUABIIBAKffznG7CddPvTyv8VFLP8CJ
  3536. '' SIG '' KknWy7Jp8LJnptz+QdfY0ywUNxcjt5N2lBSy+Q6t93bz
  3537. '' SIG '' i6w6qQ6B3eZK7KtF2s0kWzSebRm9Mw0bcOxLWKz2FnuN
  3538. '' SIG '' BwhQp+CpJbKf6egJaqWfgbo7ULkrZhM9LqiBZE7OqLTn
  3539. '' SIG '' bRo22pHAgTEIo3wzO6ul203i98aJ1HMM42xKuqgFEe/9
  3540. '' SIG '' 6qDnWEvZZu/UpH7jU4PogKEZxH1EQrahyaVxHAwg6J1X
  3541. '' SIG '' uh55iLbkcXoKLJ19E/djijoX9qUnFp7Vccw6VebJU7QR
  3542. '' SIG '' eX4R20WeD9v/7C4K+VngvBiawLQf8p+FYya6uyIbg6Yt
  3543. '' SIG '' 7gGQq8NPq1M=
  3544. '' SIG '' End signature block