'We don't need the WshNetwork object, it doesn't
'have any methods that are useful for your case.
'You also have strUserName and an extra comma at
'the end of your declarations.
Dim objFSO, strRevBackupServerPath, strNetworkPathFolder
'This is the filesystem object, we'll be using the
'FolderExists method.
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Here we use the FolderExists method to determine
'if the folder exists. Since the method returns
'a boolen true or false, we don't have to compare
'it to anything, it's evaluation is implicit.
If objFSO.FolderExists(strRevBackupServerPath & strNetworkPathFolder) Then
Wscript.Echo "Share Exists"
Else
WScript.Echo "Share Does Not Exist"
End If
VBS echo share exist from remote share path
Question
I have a vbs script that list the paths where there are Windows shares. How would I take the paths and echo if the network share(paths) exist? I think I need to use Network Object to see if share path = true, but I don't know how to?
Any help?
Dim objNetwork, strUserName, strNetworkPathFolder, strRevBackupServerPath,
Set objNetwork = CreateObject("WScript.Network")
strRevBackupServerPath="\\SERVER\"
strNetworkPathFolder="BackupPC_RevisonFileBackup$"
If strRevBackupServerPath&strNetworkPathFolder = true then
WScript.Echo "Share Exists"
Else
WScript.Echo "Share Does Not Exists"
End If
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow