I'm trying to disconnect all sessions made from clients to my server. Just like doing in commandline a "Net Session //clientName /delete" for all "clientname".
I already tried the old ".bat" method :
- Wscript.run of "Net Session > myfile.txt"
- Read "myfile.txt" after to extract the stations names
- For each stations names : Wscript.run of "Net Session \\stationName /delete"
The problem is that the bat redirecting with a ">" char doesn't work in Wscript.
I've found the NetSessionDel Api
But an Api can't be directly called from vbs and I don't want to use an OCX or dll because of deployement.
So, if someone has got an idea
- either to correctly redirect the stdout in run method of Wscript object.
- or to delete sessions in vbs in a "cleaner" method,
that would be amazing, wonderfull, giga top wizz !!! Water is not bad as long as it stays out human body ;-)
I already tried the old ".bat" method :
- Wscript.run of "Net Session > myfile.txt"
- Read "myfile.txt" after to extract the stations names
- For each stations names : Wscript.run of "Net Session \\stationName /delete"
The problem is that the bat redirecting with a ">" char doesn't work in Wscript.
I've found the NetSessionDel Api
But an Api can't be directly called from vbs and I don't want to use an OCX or dll because of deployement.
So, if someone has got an idea
- either to correctly redirect the stdout in run method of Wscript object.
- or to delete sessions in vbs in a "cleaner" method,
that would be amazing, wonderfull, giga top wizz !!! Water is not bad as long as it stays out human body ;-)