Quantcast
Channel: THWACK: All Content - Server & Application Monitor
Viewing all articles
Browse latest Browse all 12281

Unable to check if path exists using VB Script

$
0
0


Hi,

 

We are trying to access a set of files on a windows server to read the statistics present in these files. We are using the Windows Script Monitor component (vbscript) on SAM.

The files are present in a folder on the E drive on the target node. The folder is not shared on the network. However it is shared with the local user (same username as that of on the Solarwinds server connected to the domain controller. The target node is not connected to this domain controller) for read only. This local user has local logon permission on the target node. Solarwinds SAM is installed on a different subnet than this target node.

 

Here is our script.

 

Option Explicit
On Error Resume Next

if (WScript.Arguments.Count <> 1) then
WScript.Echo "Statistic: 0"

  WScript.Echo "Message: USAGE: <IP>

  WScript.Quit(1)
else
Dim fso, objDir, objFiles, path
path = "\\" & Wscript.Arguments(0) & "\E$\TempFolder\"
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(path) Then

   WScript.Echo "Statistic: 1"

   WScript.Echo "Message: Path Exists"

   Wscript.Quit(0)

else

  WScript.Echo "Statistic:2"

  WScript.Echo "Message: Path does not exists"

  WScript.Quit(1)

end if

 

 

When we run this script on SAM towards the target node, with the username as defined above, the output always evaluates to path does not exists.

Please help !!

 

Thanks.


Viewing all articles
Browse latest Browse all 12281

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>