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

RE: Querying the current user profile size by ESP

ESP
Thu Dec 01 15:47:03 CST 2005

This will show you the current user's profile path, as opposed to the My
Documents folder.

Const USER_PROFILE = &H28&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(USER_PROFILE)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path


ESP




"Fletch" wrote:

> 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
>
>

Re: Querying the current user profile size by Fletch

Fletch
Mon Dec 05 04:22:36 CST 2005

Many thanks, that's worked perfectly.

Regards
Anthony