[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

executing caspol from within vbscript

Matt

11/17/2008 9:49:00 AM

Hello group,

I'd like to call caspol from within a script inside a custom action in
an msi (setup project). I'd prefer a standard msi to ClickOnce,
because with a standard msi I can install drivers & associate
filetypes with our application whereas with ClickOnce I can't.

When I execute the caspol command from the command line it succeeds,
but from within vbscript it always fails with the error "Fehler:
Unbekannte Mitgliedschaftsbedingung - -url.." - which translates as
"Error: Unknown membership condition: -url". To further clarify: A
copy & paste of the generated command works fine on the command line
directly on the local drive of a virgin virtual machine, as local
administrator, as part of a workgroup.

I have two ideas:
1. I'm no vbscript king, so maybe I've missed quotes or made some
other sort of syntax error.
2. Caspol recognises that I'm running it from within a script and
halts with an intentionally nonsensical error.

Personally, I believe it's just a dumb syntax error.

Here's my script:

set sh = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

dim command
dim location
dim retVal

location = fso.GetFile(Wscript.ScriptFullName).ParentFolder

'%windir%\microsoft.net\framework\v2.0.50727\caspol.exe -pp off -m -
addgroup 1 –url file://COMPUTER/SHARE/* FullTrust -name sbw2
command = fso.GetSpecialFolder(0) & "\microsoft.net\framework
\v2.0.50727\caspol.exe -pp off -m -ag 1 –url file://"
for each s in Split(location, "\")
if Len(s) > 0 then
command = command & s & "/"
end if
next
command = command & "* FullTrust -name sbw2"

'DEBUG
'command = fso.GetSpecialFolder(0) & "\microsoft.net\framework
\v2.0.50727\caspol.exe -m -ag 1 –url file://mjlaptop/sbw2/* FullTrust"
Wscript.StdOut.WriteLine VbClrf
Wscript.StdOut.WriteLine command
Wscript.StdOut.WriteLine VbClrf

Set output = sh.Exec(command)

dim text
while Not output.StdOut.AtEndOfStream
text = text & output.StdOut.Read(1)
Wend
Wscript.StdOut.WriteLine text

Thanks in advance,

Matt
2 Answers

Phil Wilson

11/17/2008 6:39:00 PM

0

You cannot use the WScript object inside a Windows Installer custom action
VBScript. That's because you're not running inside the WScript hosting
object model, you're running in MSI's.

--
Phil Wilson
Definitive Guide to Windows Installer
http://www.apress.com/book/view/...


"Matt" <matt.m.jacobsen@gmail.com> wrote in message
news:563d0ba7-d286-4719-baa1-6d2e6045af13@i20g2000prf.googlegroups.com...
Hello group,

I'd like to call caspol from within a script inside a custom action in
an msi (setup project). I'd prefer a standard msi to ClickOnce,
because with a standard msi I can install drivers & associate
filetypes with our application whereas with ClickOnce I can't.

When I execute the caspol command from the command line it succeeds,
but from within vbscript it always fails with the error "Fehler:
Unbekannte Mitgliedschaftsbedingung - -url.." - which translates as
"Error: Unknown membership condition: -url". To further clarify: A
copy & paste of the generated command works fine on the command line
directly on the local drive of a virgin virtual machine, as local
administrator, as part of a workgroup.

I have two ideas:
1. I'm no vbscript king, so maybe I've missed quotes or made some
other sort of syntax error.
2. Caspol recognises that I'm running it from within a script and
halts with an intentionally nonsensical error.

Personally, I believe it's just a dumb syntax error.

Here's my script:

set sh = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

dim command
dim location
dim retVal

location = fso.GetFile(Wscript.ScriptFullName).ParentFolder

'%windir%\microsoft.net\framework\v2.0.50727\caspol.exe -pp off -m -
addgroup 1 ?url file://COMPUTER/SHARE/* FullTrust -name sbw2
command = fso.GetSpecialFolder(0) & "\microsoft.net\framework
\v2.0.50727\caspol.exe -pp off -m -ag 1 ?url file://"
for each s in Split(location, "\")
if Len(s) > 0 then
command = command & s & "/"
end if
next
command = command & "* FullTrust -name sbw2"

'DEBUG
'command = fso.GetSpecialFolder(0) & "\microsoft.net\framework
\v2.0.50727\caspol.exe -m -ag 1 ?url file://mjlaptop/sbw2/* FullTrust"
Wscript.StdOut.WriteLine VbClrf
Wscript.StdOut.WriteLine command
Wscript.StdOut.WriteLine VbClrf

Set output = sh.Exec(command)

dim text
while Not output.StdOut.AtEndOfStream
text = text & output.StdOut.Read(1)
Wend
Wscript.StdOut.WriteLine text

Thanks in advance,

Matt


Lawrence T. Akutagawa

5/11/2012 11:01:00 PM

0

"Lawrence T. Akutagawa" wrote in message news:joh4fl$4uq$1@dont-email.me...

"Jerry Okamura" wrote in message news:xiUqr.1703$9Q6.1511@newsfe18.iad...

What happened to people, who got into a deep financial hole, before
bankruptcy laws existed?

/snip - follow the thread/

*********
[That line of asterisks is for the benefit of "Earl Evleth" el al so
they are aware that what precedes those asterisks is the post I am
addressing and what comes after those asterisks is my response to that post
so those folks don't misquote me as they otherwise are apt to do...and have
in the past done]

Welcome back from under that rock of yours, Jerry....

Yet once again Jerry Okamura, proven hypocrite extraordinaire and evader
military service, show how deficient he is in researching his own Jerry
Okamura questions. I think I should add to Jerry's appellation here
something like - "he who never researches/substantiates." C'mon Jerry were
you asleep in high school world history? And you say you have a college
degree with which you ducked military service? I personally know some
Aragon High School kids who put your knowledge of world history to shame.
http://en.wikipedia.org/wiki/Debtors...
http://www.conservapedia.com/Debtor...

Now are you AGAIN going to crawl back under that rock of yours, Jerry?

**************
Clearly Jerry Okamura - hypocrite extraordinaire and evader of military
service who never researches/substantiates his own Jerry Okamura questions -
has yet AGAIN crawled back under that favorite rock of his.