Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 1st, 2009, 12:56 PM
albadmin albadmin is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 2 albadmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 8 sec
Reputation Power: 0
General Scripting - Active pc connections

Hello,

i have the following problem and any help will be very much appriciated:

I need to write a script (.bat) that warns me before windows closure that active Lan connections with my pc are active (if any).

the way i intend to automate script execution is to schedule it with planned windows operations.. and the notification should be a dialog box that asks for shutdown approval !

I only know the cmd's to get the active connections and .. but the part of finding ( iteratively check the output of netstat cmd.) is complicated for me.

Thanks in advance !

Reply With Quote
  #2  
Old September 2nd, 2009, 12:13 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Windows already warns you if others are connected to your computer when you attempt to shut down.
__________________
Don't like me? Click it.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!

Help us help you! Post your exact error message with these easy tips!

Reply With Quote
  #3  
Old September 2nd, 2009, 10:49 AM
albadmin albadmin is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 2 albadmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 8 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
Windows already warns you if others are connected to your computer when you attempt to shut down.


Actually it doesn't and this shocked me ! Do i need to do some extra config somewhere ?

Can u still provide me with some script lines ?!

Thank you

Reply With Quote
  #4  
Old September 4th, 2009, 06:59 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by albadmin
Actually it doesn't and this shocked me ! Do i need to do some extra config somewhere ?
Nope. Sounds like someone has suppressed the default message or set Windows to perform a forced shutdown.[/url]
Quote:
Originally Posted by albadmin
Can u still provide me with some script lines ?!

Thank you
Well, I can try. I've never actually tried to do this before and there's no documented way that I'm aware of. However, if you're using Active Directory, this might work for you.
vb Code:
Original - vb Code
  1. ' This VBScript code lists the connection objects for a server
  2.  
  3. ' ---------------------------------------------------------------
  4. ' From the book "Active Directory Cookbook" by Robbie Allen
  5. ' ISBN: 0-596-00466-4
  6. ' ---------------------------------------------------------------
  7.  
  8. ' ------ SCRIPT CONFIGURATION ------
  9. strServer = "<ServerName>"  ' e.g. dc01
  10. strSite   = "<SiteName>"    ' e.g. MySite1
  11. ' ------ END CONFIGURATION ---------
  12.  
  13. set objRootDSE = GetObject("LDAP://RootDSE")
  14. set objNTDSCont = GetObject("LDAP://cn=NTDS Settings,cn=" & strServer & _
  15.                             ",cn=servers,cn=" & strSite & ",cn=sites," & _
  16.                              objRootDSE.Get("configurationNamingContext") )
  17. objNTDSCont.Filter = Array("ntdsConnection")
  18. WScript.Echo "Connection objects for " & strSite & "\" & strServer
  19. for each objConn in objNTDSCont
  20.    if objConn.Get("options") = 0 then
  21.       Wscript.Echo "  " & objConn.Get("cn") & " (MANUAL)"
  22.    else
  23.       Wscript.Echo "  " & objConn.Get("cn") & " (AUTO)"
  24.    end if
  25. next

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > General Scripting - Active pc connections


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek