Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Script to list open files

Reply
 
Old 05-12-2009   #1 (permalink)
Keith


 
 

Script to list open files

I am having trouble getting the following script from the Scripting Guys to
run on my SBS2003 Premium server:

Set objConnection = GetObject("WinNT://atl-ws-01/LanmanServer")
Set colSessions = objConnection.Sessions

For Each objSession in colSessions
Wscript.Echo "Computer: " & objSession.Computer
Wscript.Echo "Connected Time: " & objSession.ConnectTime
Wscript.Echo "Idle Time: " & objSession.IdleTime
Wscript.Echo "Name: " & objSession.Name
Wscript.Echo "User: " & objSession.User
Wscript.Echo
Next

The error is in the first line. The error message states that "The network
path was not found." I tried rebooting the server as I had read that
restarting the Server (LanManServer) might resolve the issue, but it did not.
Any ideas as to why this simple script won't work?

Thanks,

Keith


My System SpecsSystem Spec
Old 05-12-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Script to list open files


"Keith" <Keith@xxxxxx> wrote in message
news:1AAAB8A5-1000-49FE-9B28-E6683F1F741F@xxxxxx
Quote:

>I am having trouble getting the following script from the Scripting Guys to
> run on my SBS2003 Premium server:
>
> Set objConnection = GetObject("WinNT://atl-ws-01/LanmanServer")
> Set colSessions = objConnection.Sessions
>
> For Each objSession in colSessions
> Wscript.Echo "Computer: " & objSession.Computer
> Wscript.Echo "Connected Time: " & objSession.ConnectTime
> Wscript.Echo "Idle Time: " & objSession.IdleTime
> Wscript.Echo "Name: " & objSession.Name
> Wscript.Echo "User: " & objSession.User
> Wscript.Echo
> Next
>
> The error is in the first line. The error message states that "The
> network
> path was not found." I tried rebooting the server as I had read that
> restarting the Server (LanManServer) might resolve the issue, but it did
> not.
> Any ideas as to why this simple script won't work?
>
> Thanks,
>
> Keith
>
The Scripting Guy's explanation says "here's a script that binds to the file
service on the computer atl-ws-01". I suspect that your server has a name
other than "atl-ws-01", hence the error message.


My System SpecsSystem Spec
Old 05-12-2009   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: Script to list open files

Is "atl-ws-01" the NetBIOS name of the server? If not, replace this string
with the name of your server. Or, if you are running the script on the
server, you can have the script retrieve the NetBIOS name:

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objConnection = GetObject("WinNT://" & strComputer & "/LanmanServer")

If you are running the script remotely, you need to assign the name to the
variable strComputer. Finally, I believe you must have administrator
privileges or you will get no sessions.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
"Keith" <Keith@xxxxxx> wrote in message
news:1AAAB8A5-1000-49FE-9B28-E6683F1F741F@xxxxxx
Quote:

>I am having trouble getting the following script from the Scripting Guys to
> run on my SBS2003 Premium server:
>
> Set objConnection = GetObject("WinNT://atl-ws-01/LanmanServer")
> Set colSessions = objConnection.Sessions
>
> For Each objSession in colSessions
> Wscript.Echo "Computer: " & objSession.Computer
> Wscript.Echo "Connected Time: " & objSession.ConnectTime
> Wscript.Echo "Idle Time: " & objSession.IdleTime
> Wscript.Echo "Name: " & objSession.Name
> Wscript.Echo "User: " & objSession.User
> Wscript.Echo
> Next
>
> The error is in the first line. The error message states that "The
> network
> path was not found." I tried rebooting the server as I had read that
> restarting the Server (LanManServer) might resolve the issue, but it did
> not.
> Any ideas as to why this simple script won't work?
>
> Thanks,
>
> Keith
>

My System SpecsSystem Spec
Old 05-12-2009   #4 (permalink)
Keith


 
 

Re: Script to list open files

Thanks for the help!

Keith


"Richard Mueller [MVP]" wrote:
Quote:

> Is "atl-ws-01" the NetBIOS name of the server? If not, replace this string
> with the name of your server. Or, if you are running the script on the
> server, you can have the script retrieve the NetBIOS name:
>
> Set objNetwork = CreateObject("Wscript.Network")
> strComputer = objNetwork.ComputerName
> Set objConnection = GetObject("WinNT://" & strComputer & "/LanmanServer")
>
> If you are running the script remotely, you need to assign the name to the
> variable strComputer. Finally, I believe you must have administrator
> privileges or you will get no sessions.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
> "Keith" <Keith@xxxxxx> wrote in message
> news:1AAAB8A5-1000-49FE-9B28-E6683F1F741F@xxxxxx
Quote:

> >I am having trouble getting the following script from the Scripting Guys to
> > run on my SBS2003 Premium server:
> >
> > Set objConnection = GetObject("WinNT://atl-ws-01/LanmanServer")
> > Set colSessions = objConnection.Sessions
> >
> > For Each objSession in colSessions
> > Wscript.Echo "Computer: " & objSession.Computer
> > Wscript.Echo "Connected Time: " & objSession.ConnectTime
> > Wscript.Echo "Idle Time: " & objSession.IdleTime
> > Wscript.Echo "Name: " & objSession.Name
> > Wscript.Echo "User: " & objSession.User
> > Wscript.Echo
> > Next
> >
> > The error is in the first line. The error message states that "The
> > network
> > path was not found." I tried rebooting the server as I had read that
> > restarting the Server (LanManServer) might resolve the issue, but it did
> > not.
> > Any ideas as to why this simple script won't work?
> >
> > Thanks,
> >
> > Keith
> >
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Need Help With Script To List and Delete Printers VB Script
remove list of files from open dialog box Vista General
is there any script to get a list of COM Objects in a computer? PowerShell
list open files in a shared folder PowerShell
Optimizing PS Script to List directories PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46