473,413 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Script works with Wscript but not in ASP

I have the following script:

<%
strComputer = "CPU210"
Set objWMIService = GetObject("winmgmts://" & strComputer &
"/root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
serialno = objItem.SerialNumber
Next

%>
<%=serialno%>

If i'm logged onto the computer "CPU210" it will display the serial
number. If I change the strComputer variable to "CPU215" and try to run
this page on CPU210 i get an error. But if i run the page on CPU215
with strComputer = CPU215 it works.

If i put this into a VBScript it works fine, no matter what computer i
run it on and no matter what the strComputer variable is.

So my question is, how do I fix this. All i'm trying to do is get the
LOCAL serial number from a computer in AD. I am not trying to get the
serial number from AD. I want to get the serial number from the actual
machine.

Nov 23 '05 #1
2 1117
"multisync" <th**********@hotmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
I have the following script:

<%
strComputer = "CPU210"
Set objWMIService = GetObject("winmgmts://" & strComputer &
"/root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
serialno = objItem.SerialNumber
Next

%>
<%=serialno%>

If i'm logged onto the computer "CPU210" it will display the serial
number. If I change the strComputer variable to "CPU215" and try to run
this page on CPU210 i get an error. But if i run the page on CPU215
with strComputer = CPU215 it works.

If i put this into a VBScript it works fine, no matter what computer i
run it on and no matter what the strComputer variable is.

So my question is, how do I fix this. All i'm trying to do is get the
LOCAL serial number from a computer in AD. I am not trying to get the
serial number from AD. I want to get the serial number from the actual
machine.

You may want to try the classic ASP group:
news://msnews.microsoft.com/microsof...er.asp.general
Nov 23 '05 #2
I couldn't find anything there.

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Larry Woods | last post by:
I need to execute a Windows script (wscript/cscript) from an ASP page for some administrative functions. Anyone doing this? If so, how? TIA, Larry Woods
2
by: Christoph | last post by:
The following script works fine on two Webservers in the internet, but it doesn't work on my local Webserver (Xitami). I also tried the IIS, with the same result - the script isn't forwarding me ...
2
by: Steve Henderson | last post by:
I have really surprised myself and written a script that actually works! <grin>. As you will be able to tell, I'm really, really new to this scripting stuff... My script does a task and then sleeps...
14
by: Aaron | last post by:
Is there a script that monitor (ping) my website every hour and run iisreset if it receives an error or no response. Thanks Aaron
2
by: hotairguy | last post by:
I want change DNS server setting on quite a few clients in a single domain env. They all have static IP setting which I can't change (can't use DHCP) so looking for a way to change settings with a...
2
by: Chase | last post by:
I'm working in ASP.NET 2.0 and am having problems with some client side script on my .aspx pages. The script looks like this: <script language=vbscript> function OpenFile(FileToOpen) Set...
3
by: jaeden99 | last post by:
I was wandering if nyone has a script to move files older than x days old? i've seen several to delete, but I don't want to delete. I would like to create a backup of the files first verify with...
5
by: Nikolay Belyh | last post by:
I have created a "collection" in C# like this: namespace ClassLibrary1 { public class X {} public class Class1 { public ArrayList objs {
1
by: =?Utf-8?B?Sm9obkJhdGVz?= | last post by:
Problem: I need to backup and clear the security event log. I have this working via a vbsscript which I will post below. However while I can use this script manually it is not user friendly and...
0
by: johanot | last post by:
HELP. :) I found a usefull script at isascripts.org. The script fills a computerset with names and IP-adresses. I'm running IIS and ISA server on the same machine and I would like to let the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.