wshshell.run

P

Paul Bergson

I'm trying to start up a command from inside my asp code to modify
permissions on folders. When I do I get the error

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/newuser.asp, line 120



Line 120 is the WshShell.Run strWShell This works fine in vb script.
I'm not very savvy with asp so I'm unclear as to why I'm getting this error?


'Create Folder Skeleton
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''
''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''
Set FS = CreateObject("Scripting.FileSystemObject")
Set WSHNetwork = CreateObject("WScript.Network")

Set WshShell = WScript.CreateObject("WScript.Shell")



FS.CreateFolder(ParentDir & strName)
'Build Domain Admins

On Error Goto 0

strWShell = "\\admin04\bin\xcacls " & ParentDir & strName & " /G " &
txtQuote & "GOB\Domain Admins" & txtQuote & ":F /Y"
WshShell.Run strWShell


Any help is appreciated.
 
M

Mark Rae

Line 120 is the WshShell.Run strWShell This works fine in vb
script.
I'm not very savvy with asp so I'm unclear as to why I'm getting this
error?

Are you actually talking about "classic" ASP, i.e. not ASP.NET?
 
S

Steve C. Orr [MVP, MCSD]

Web pages do not have this level of security permissions by default.
If web pages could run anything they wanted on a users machine, that would
be quite a security hole, don't you think?
You can only get this to work in IE if each browser has customized security
options that allow it to work.
 
P

Paul Bergson

Yet this is classic and I'm trying to get it to run it on the server side.
I'm not even sure if it is possible.

--

Paul Bergson MCT, MCSE, MCSA, CNE, CNA, CCA

This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Paul Bergson

I'm trying to get this to run on the server side. Should have nothing to do
with the client
 
S

Steve C. Orr [MVP, MCSD]

OIC, well you still may be having permission issues. Make sure the ASPNET
user account has permission to access the file, or use impersonation to have
it run under another user account.
And you probably shouldn't be using scripting. This is ASP.NET and there
are better ways, such as the Process namespace:

Dim csc As System.Diagnostics.Process = New System.Diagnostics.Process()
csc.StartInfo.FileName = "c:\SomePath\MyCommandLineApp.exe"
csc.Start()

Here's more info:
http://msdn.microsoft.com/library/d...rfsystemdiagnosticsprocessclassstarttopic.asp
 
P

Paul Bergson

Ok I can get a program to fire off but I can't pass it parameters. Sorry I
don't have any experience in this arena and I'm struggling at best. Is
there a way to start up a program and have parameters to go with it? When I
build the filename with parameters it breaks when I run without parameters
it works.


Thanks for your advice
--

Paul Bergson
 
Joined
Jan 31, 2008
Messages
1
Reaction score
0
csc.Start()

Hey Steve C.
Your solution worked great, but it only works if i use my dev machine using asp.net 2, i guess its because its using my account. I use it to install network printers, but if run it from my webserver, i have permission issues obviously.

This is the code i have:
Protected Sub r4500_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles r4500.Click
Dim csc As System.Diagnostics.Process = New System.Diagnostics.Process()
csc.StartInfo.FileName = "\\audafnp1\Ricoh_color_29"
csc.Start()
End Sub

But i get this error when clicking the event button on the web page:
Exception Details: System.ComponentModel.Win32Exception: Logon failure: unknown user name or bad password

---Do you know how to pass in the user's username and password in this function? I know that it uses aspnet so it will not work, and I tried with my account in the webconfig in the Impersonate part, but still no dice.

Thanks for all your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top