When I run manually, text get appended, when I deploy this with SCCM only one computer writes to the file.
What am I doing wrong here?
Thanks for any help
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
Dim FSO, objFolder,datafolder,strFile
strFile = "\\server01\share$\cachesize.txt"
Const ForAppending = 8
Set fso= CreateObject("Scripting.FileSystemObject")
If fso.FolderExists("c:\windows\ccmcache") Then
Set objFolder= FSO.GetFolder("c:\windows\ccmcache")
ShowFolderDetails objFolder
Sub ShowFolderDetails(oF)
datafolder = oF.Size/1073741824
end sub
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile(strFile, ForAppending, True)
objFile.WriteLine(strComputerName &" "& datafolder &" "& Now)
objFile.Close
End If