Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2006, 01:56 PM
Authorized User
 
Join Date: Dec 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shahhussain Send a message via Yahoo to shahhussain
Default How to shut down Computer using ASP 3.0

Hello All,
Can Any body tell me how to shut down the clint computer from my website through an ASP V 3.0.
I am using the following function code:
================================================== =====
<%
Sub ShutDown()
  Dim Connection, WQL, SystemClass, System

  'Get connection To local wmi
  Set Connection = GetObject("winmgmts:root\cimv2")

  'Get Win32_OperatingSystem objects - only one object In the collection
  WQL = "Select Name From Win32_OperatingSystem"
  Set SystemClass = Connection.ExecQuery(WQL)

  'Get one system object
  'I think there is no way To get the object using URL?
  For Each System In SystemClass
    System.Win32ShutDown (2)
  Next
End Sub


call ShutDown()
%>
=================================================
Please help me i have tried to do this but it throw an Error as:
Error Type:
(0x80041003)
/shut.asp, line 6


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 2.0.50727


Shahhussain
__________________
Shahhussain
 
Old August 20th, 2006, 02:00 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Is this a VBScript (ala WSH) question or an ASP question?? Remember that ASP scripts execute on the SERVER, not the client, so if I were to do something similar to this in ASP:

Shell(Notepad.exe)

Notepad would open on the server, not the client. However, if you are trying to shut down PC's in a network environment this can be done through AD or the use of Windows Script Host files (WSH) which can be wrote in VBScript (as well as a myraid of other languages).

HTH

"The one language all programmers understand is profanity."
 
Old August 24th, 2006, 05:09 AM
Authorized User
 
Join Date: Dec 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shahhussain Send a message via Yahoo to shahhussain
Default

hello dparsons,
Thanks for reply I am using the vbscript to shut down the clint computer but do not know how to do this can you please write a code to shutdown clint computer using VBscripts inside the ASP pages?
Thanks again.

Shahhussain
 
Old August 24th, 2006, 07:22 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You are not understanding me. You can use VBScript to write a WSH (Windows Script Host) File that will shut down a PC but this only works in a network environment, you can NOT send a shut down command remotely from a web page. Even if you were to write a web page that were to execute the shutdown command, the page would attempt to shutdown your webserver, not the client.

"The one language all programmers understand is profanity."
 
Old August 24th, 2006, 03:01 PM
Authorized User
 
Join Date: Dec 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shahhussain Send a message via Yahoo to shahhussain
Default

Oh.........hhh
Ok I understand now.
You really clear my mind from this conclusion.
Thanks again

Shahhussain





Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading Files on Client's Computer in asp.net Dilip Nagle General .NET 0 August 22nd, 2006 11:16 PM
shut down anchal C# 3 July 10th, 2006 11:48 PM
Shut down Access database ppenn Access VBA 3 September 1st, 2005 09:48 AM
ASP.Net application times out, locks up computer davidayres VS.NET 2002/2003 0 March 18th, 2005 11:30 AM
How to retrive the computer name in ASP? jayaraj Classic ASP Professional 3 July 24th, 2004 01:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.