I copied this from itninja to try out but it errors out and I don't know why, any suggestions?


Dim objFSO, newfolder
Dim strComputer, objWMIService
Dim fso, fsHandle, objShell,LogFileName, colItems, objItem

set objFSO=CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists("c:\Windows\KBOX") Then
  newfolder = objFSO.CreateFolder ("c:\Windows\KBOX")
End If

Set objShell = CreateObject("Wscript.Shell")
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")

If objFSO.FileExists("c:\Windows\KBOX\local_and_network_drives.txt") Then
fso.DeleteFile "c:\windows\KBOX\local_and_network_drives.txt", True
End If

LogFileName= "C:\Windows\KBOX\local_and_network_drives.txt"
set fsHandle = fso.OpenTextFile (LogFileName,8,True)

sUser = ConsoleUser(".") ' use "." for local computer

Function ConsoleUser(sHost)
' Returns name of user logged on to console
' If no users are logged on, returns ""
Dim oWMI, colProc, oProcess, sUser, sDomain

1 Comment   [ - ] Hide Comment


  • When you see this type of nonsense:

    set objFSO=CreateObject("Scripting.FileSystemObject")
    Set fso = Wscript.CreateObject("Scripting.FilesystemObject")

    you know instantly that whoever created the script has no clue what they're doing and their output is to be avoided at all costs.

    If you don't know why it's nonsense, then you need to do a *lot* more research!
Please log in to comment

Answer this question or Comment on this question for clarity



Where is the rest of the code after "Dim oWMI, colProc, oProcess, sUser, sDomain"

Answered 12/10/2013 by: pcooper
Senior White Belt

Please log in to comment

What commandline are you using to call this script? Cause error 193 seems to suggest you're not calling a valid win32 executable.. (193: %1 is not a valid Win32 application)

Maybe you're forgetting to run the script through cscript.exe <yourscript.vbs>?

Answered 12/11/2013 by: pjgeutjens
Red Belt

Please log in to comment