错误:
space.vbs(13,2)Microsoft VBScript运行时错误:找不到路径
servers.txt存在且可读 我可以将驱动器映射到servers.txt中的任何服务器并手动检查空间
除非我的代码中存在语法错误,否则可能是身份验证问题?我不确定如何创建网络使用或在vbs中运行。虽然我说我可以手动映射一个驱动器。
显然有错误的行 set d = objfso.GetDrive(" \ strComputer \ c $")
space.vbs查询服务器列表并返回可用空间
dim strInputPath, strOutputPath
dim objFSO, objTextIn, objTextOut
strInputPath = "c:\servers.txt" '- location of input
strOutputPath = "c:\output.csv" '- location of output
set objFSO = CreateObject("Scripting.FileSystemObject")
set objTextIn = objFSO.OpenTextFile( strInputPath,1 )
set objTextOut = objFSO.CreateTextFile( strOutputPath )
Do until objTextIn.AtEndOfStream = True
strComputer = objTextIn.ReadLine
set d = objfso.GetDrive("\\strComputer\c$")
objTextOut.WriteLine now & "," & strComputer & "," & d.FreeSpace/1073741824
loop
答案 0 :(得分:0)
所以:
>> strComputer = "pipapo"
>> WScript.Echo 1, "\\strComputer\c$"
>> WScript.Echo 2, "\\" & strComputer & "\c$"
>>
1 \\strComputer\c$
2 \\pipapo\c$