I need to get the value of the current user's profile size, then insert
that value into the registry.
I have found a similar script which gets the size of the current user's
My Documents folder (see below) and inserts into the registry, but I
cannot find anything similar for the current user profile size.
Many thanks
Option Explicit
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_MULTI_SZ = 7
Const CSIDL_PERSONAL = &H5& '// My Documents
Dim objWSH, blnKey, objFSO, objShell, objFolder, lSize, sRegPath, x
sRegPath = "HKCU\MyDocuments_Size"
'// Open, use, destroy ...
Set objShell = CreateObject("Shell.Application")
objFolder = objShell.Namespace(CSIDL_PERSONAL).self.path
Set objShell = Nothing
'// Get the size and store it in a local var
Set objFSO = CreateObject("Scripting.FileSystemObject")
lSize = objFSO.GetFolder(objFolder).Size: Set objFolder = Nothing: Set
objFSO = Nothing
Set objWSH = WScript.CreateObject("WScript.Shell")
'// Code to create the key (sRegPath must end in a backslash for this)
objWSH.RegWrite sRegPath, 1, "REG_SZ"
'// Code to add the value
objWSH.RegWrite sRegPath, lSize, "REG_SZ"
Set objWSH = Nothing