Hi,
I need help creating a script that will go through a computer, look at all the user profiles in C:\Documents and Settings, then for each profile it finds, it lists the size of the My Documents folder in MB, preferably without the My Music and My Pictures folders. i need it to write the computer name, the profile, and the size of the folder into a CSV file on my computer.
is this possible with VBScript?
-R.Struble
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 8Oct2009,06:02 | #2 |
|
Yes, it is possible in VBScript
![]() But, how far have you reached ? We won't write the whole code for you. We can "help" you make your code better. Hint : Use VBScript's Folder object. |
|
Go4Expert Member
|
|
| 8Oct2009,19:19 | #3 |
|
to tell da truth, i dont know much about VB script at all. my boss is trying to help me, but we cant figure out how to make our script able to run through Altiris, right now i have to type in the computer name in a input box.
If there is a special way to post the code we have, please let me know so i can show you what we have so far ![]() -RS |
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 8Oct2009,21:06 | #4 |
|
Yeah, post your code here.
Remember to enclose it within [code=VB] . . <your code here> . . [/code] |
|
Go4Expert Member
|
|
| 9Oct2009,20:00 | #5 |
|
Code: VB
Like that? -RS Last edited by SaswatPadhi; 9Oct2009 at 20:48.. Reason: Unnecessary periods |
|
Newbie Member
|
|
| 22Oct2009,04:02 | #6 |
|
I'm trying to get the script to save to \\remote_server\D$\Logs\%computername%" instead of \\remote_server\D$\Logs\".
I'm new to VB and I've been trying for about 2 weeks. I'm doing something wrong. Can you stear me in the right direction? ================================================== ========= Code:
Dim DestServer, strComputer
' Put in the UNC path for where you want the logs to be stored
DestServer = "\\remote_server\D$\Logs\"
'Create the Time variables
sDate=Right("0" & Month(Date),2) _
& "-" & Right("0" & Day(Date),2) _
& "-" & Right(Year(Date),2)
sTime = DatePart("h", Now) & DatePart("n", Now)
set oFSO = CreateObject("Scripting.FileSystemObject")
'If correct folder doesn't exist, make it
if Not oFSO.FolderExists(DestServer & sDate) then
set oFolder = oFSO.CreateFolder(DestServer & sDate )
end if
'Gets the log files for this machine
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate, (Backup, Security)}!\\" _
& strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile")
'This section goes out and gets the hostname this is run on for us.
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
strHOSTNAME = objItem.Name
NEXT
'Now archive the logs and clear them
if oFSO.FolderExists(DestServer & sDate) then
For Each objLogfile in colLogFiles
strBackupLog = objLogFile.BackupEventLog _
(DestServer & strComputer & sDate & "\" & strHOSTNAME & "_" & objLogFile.LogFileName & "_" & sDate & "_" & sTime & ".evt")
objLogFile.ClearEventLog()
Next
end if
|
|
Invasive contributor
|
![]() |
| 22Oct2009,21:26 | #7 |
|
You need to moify the below line, and add the computername to it
Code: vb
You can fetch it from environment variables, using the below code Code: vb
and then you can modify the code to Code: vb
Few more ways to get computername: here Last edited by nimesh; 22Oct2009 at 21:28.. |



