Jump to content

Recommended Posts

Posted (edited)

hi guys i have a script that im trying to run, it gets all local profile sizes for the person that it rns against, this works on xp current.y, not 7

 

on win 7 i get following error:

 

win 7 error.JPG

 

 

' You must provide the unc path of a shared folder.

' users must have write and modify permisions on that folder.

 

Const MY_DOCUMENTS = &H5&

Const ForReading = 1

Const ForWriting = 2

 

Dim WshNetwork, strUsername, strComputername, Description

Dim objFolder, Drv, FilePath, strFile, FolderSize1, FolderSize2

Set WshNetwork = WScript.CreateObject("WScript.Network") 

 

'Output to share (type unc name of the shared folder)

FilePath = "\C:\localprf"

 

strUsername = WshNetwork.UserName

strComputername = WshNetwork.ComputerName

 

Dim objFSO, strMY_DOCUMENTS, objFile' Global scopes

Set objFSO = CreateObject("Scripting.FileSystemObject")

 

WithCreateObject("Shell.Application").Namespace(MY_DOCUMENTS)

   strMY_DOCUMENTS = .Self.Path

   Set objFolder = objFSO.GetFolder(strMY_DOCUMENTS)

   drv = objFolder.drive

EndWith

 

' Determine drivetype of the My Documents Folder

Description = strUsername & "'s Documents on "

If (DriveIsLocal(drv) = True) Then

   Description = Description & strComputername

Else

   Description = Description & "Fileserver"

EndIf

strFile = FilePath & "\" & Description & ".txt"

 

' convert byte to megabyte (1 megabyte = 1 048 576 byte)

FolderSize1 = objFolder.Size' bytes

FolderSize2 = RoundFormatNumber(FolderSize1/1048576, 2) ' megabytes

 

 

really appreciate your help

 

thanks

winxp.JPG

Edited by rhmphrey

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...