Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Vbscript to add/rem Reg key will not work when scripte is deployed via SMS

2 views
Skip to first unread message

tro...@integrysgroup.com

unread,
Apr 3, 2008, 10:11:08 AM4/3/08
to
I have written several vbs scripts to add/remove a Registry Key for
HKCU. The scripts work correctly when tested. However, the rub is,
in SMS when I create a new program and advertise it, when the ad is
ran, it does not do anything to registry!
Lemme give you one example of what I have:

SMS Package: DeleteKey
Command Line: cscript DeleteKey.vbs

'DeleteKey

Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Office\MS Project\Profiles\Project
Server"
objRegistry.DeleteKey HKEY_CURRENT_USER, strKeyPath

Why does this work when running the script from command line, and
doesn't work when execute via SMS. I'm hoping someone can help
me...I'm at a loss.

Thanks

Garth

unread,
Apr 3, 2008, 10:38:00 AM4/3/08
to
How is the advert setup? if you are running with admin mode then it will run
under the local system context and delete the regkey from the local system
which would be the CU for the advert.


<tro...@integrysgroup.com> wrote in message
news:e7bd421d-c871-4c17...@2g2000hsn.googlegroups.com...

tro...@integrysgroup.com

unread,
Apr 3, 2008, 11:22:01 AM4/3/08
to
On Apr 3, 9:38 am, "Garth" <S...@spam.ca> wrote:
> How is the advert setup? if you are running with admin mode then it will run
> under the local system context and delete the regkey from the local system
> which would be the CU for the advert.
>
> <trol...@integrysgroup.com> wrote in message

>
> news:e7bd421d-c871-4c17...@2g2000hsn.googlegroups.com...
>
>
>
> >I have written several vbs scripts to add/remove a Registry Key for
> > HKCU.  The scripts work correctly when tested.  However, the rub is,
> > in SMS when I create a new program and advertise it, when the ad is
> > ran, it does not do anything to registry!
> > Lemme give you one example of what I have:
>
> > SMS Package: DeleteKey
> > Command Line: cscript DeleteKey.vbs
>
> > 'DeleteKey
>
> > Const HKEY_CURRENT_USER = &H80000001
> > strComputer = "."
> > Set objRegistry=GetObject("winmgmts:\\" & _
> >    strComputer & "\root\default:StdRegProv")
> > strKeyPath = "SOFTWARE\Microsoft\Office\MS Project\Profiles\Project
> > Server"
> > objRegistry.DeleteKey HKEY_CURRENT_USER, strKeyPath
>
> > Why does this work when running the script from command line, and
> > doesn't work when execute via SMS.  I'm hoping someone can help
> > me...I'm at a loss.
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -

Not sure as to what you are inquiring about...admin mode in
Advertisement?? The advertisement was set up with name, package and
program, assigned to collection, and no mandatory assignment, advanced
client set to run from DP.

tro...@integrysgroup.com

unread,
Apr 3, 2008, 12:03:05 PM4/3/08
to
> client set to run from DP.- Hide quoted text -

>
> - Show quoted text -

Could this be an issue with the the SMSservice Account not having
sufficient rights to modify a PC's registry? And if so, how could one
verify this??

tro...@integrysgroup.com

unread,
Apr 3, 2008, 2:02:21 PM4/3/08
to
> verify this??- Hide quoted text -

>
> - Show quoted text -

I have found it adds/remove the Reg Key in HKCU\.Default\Software
\Microsoft\Office\Ms Project|Profiles, instead of HKCU\Software\...
when deploying this from SMS. Is there a script I can run to put it
in Current User or some setting in SMS?

Garth

unread,
Apr 4, 2008, 8:04:44 AM4/4/08
to
Look at you Program's properties on the Environment page, What is the Run
mode set to?

<tro...@integrysgroup.com> wrote in message
news:3884356a-b0f7-453d...@x41g2000hsb.googlegroups.com...

tro...@integrysgroup.com

unread,
Apr 4, 2008, 9:34:15 AM4/4/08
to
On Apr 4, 7:04 am, "Garth" <S...@spam.ca> wrote:
> Look at you Program's properties on the Environment page, What is the Run
> mode set to?
>
> client set to run from DP.- Hide quoted text -

>
> - Show quoted text -

Working now. I changed run mode to run with user's rights! -Thanks

0 new messages