Home All Groups Group Topic Archive Search About

Undefined variable in login script

Author
19 Feb 2009 5:04 PM
prezpwns
Hello all,

The following script consistently generates an error every time the (test) user logs in. My syntax, as far as I am concerned, is correct.

*************************************
Dim objShell
Dim Shell
Dim objURLShortcut
Dim strDesktopfld

'Create 'IT Support' shortcut to Desktops
    Set objShell = WScript.CreateObject("WScript.Shell")
    strDesktopfld = objShell.SpecialFolders("Desktop")
    Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\IT Support.url") ' Name for

'Shortcut to add
    objURLShortcut.TargetPath = "http://website.com" ' Path for shortcut
    objURLShortcut.Save
    Set Shell = CreateObject( "WScript.Shell" )


Any help is appreciated. Thanks!

Preston -- prezpwns ------------------------------------------------------------------------ prezpwns's Profile: http://forums.techarena.in/members/prezpwns.htm View this thread: http://forums.techarena.in/server-scripting/1126498.htmhttp://forums.techarena.in

Author
19 Feb 2009 5:27 PM
Pegasus (MVP)
Show quote Hide quote
"prezpwns" <prezpwns.3nv7vb@DoNotSpam.com> wrote in message
news:prezpwns.3nv7vb@DoNotSpam.com...
>
> Hello all,
>
> The following script consistently generates an error every time the
> (test) user logs in. My syntax, as far as I am concerned, is correct.
>
> *************************************
> Dim objShell
> Dim Shell
> Dim objURLShortcut
> Dim strDesktopfld
>
> 'Create 'IT Support' shortcut to Desktops
> Set objShell = WScript.CreateObject("WScript.Shell")
> strDesktopfld = objShell.SpecialFolders("Desktop")
> Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\IT
> Support.url") ' Name for
>
> 'Shortcut to add
> objURLShortcut.TargetPath = "http://website.com" ' Path for shortcut
> objURLShortcut.Save
> Set Shell = CreateObject( "WScript.Shell" )
>
>
> Any help is appreciated. Thanks!
>
> Preston

If the error message is generated by the VB Script interpreter then it will
give you a line number. Which one is it? Which line does the number refer
to?
Are all your drivers up to date? click for free checkup

Author
19 Feb 2009 6:19 PM
Al Dunbar
Show quote Hide quote
"Pegasus (MVP)" <I.***@fly.com.oz> wrote in message
news:ug3cIdrkJHA.3480@TK2MSFTNGP06.phx.gbl...
>
> "prezpwns" <prezpwns.3nv7vb@DoNotSpam.com> wrote in message
> news:prezpwns.3nv7vb@DoNotSpam.com...
>>
>> Hello all,
>>
>> The following script consistently generates an error every time the
>> (test) user logs in. My syntax, as far as I am concerned, is correct.
>>
>> *************************************
>> Dim objShell
>> Dim Shell
>> Dim objURLShortcut
>> Dim strDesktopfld
>>
>> 'Create 'IT Support' shortcut to Desktops
>> Set objShell = WScript.CreateObject("WScript.Shell")
>> strDesktopfld = objShell.SpecialFolders("Desktop")
>> Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\IT
>> Support.url") ' Name for
>>
>> 'Shortcut to add
>> objURLShortcut.TargetPath = "http://website.com" ' Path for shortcut
>> objURLShortcut.Save
>> Set Shell = CreateObject( "WScript.Shell" )
>>
>>
>> Any help is appreciated. Thanks!
>>
>> Preston
>
> If the error message is generated by the VB Script interpreter then it
> will give you a line number. Which one is it? Which line does the number
> refer to?

Seemed like a fairly simple script containing no hidden danger, so I tested
it.

Once, I removed the syntactically incorrect comment line with asterisks and
corrected the line wrap, it worked perfectly. When I re-introduced the
line-wrap in the second SET statement, it produced this error: "unterminated
string constant".

I expect that the OP either mis-interpreted the error message, or that the
script as posted is not a complete copy. I fixed the linewrap and added an
OPTION EXPLICIT message, and still no error message.

I'd suggest that the OP answer your question, post the entire script, and
explain where the script is stored, how the file is named, and what
mechanism makes it run at logon.

/Al
Author
19 Feb 2009 6:26 PM
prezpwns
Sorry - i suppose that would be helpful: Line: 11 (Set objShell) Char: 1 Code:800a01f4 Source: MicrosoftVBscript Runtime error -- prezpwns ------------------------------------------------------------------------ prezpwns's Profile: http://forums.techarena.in/members/prezpwns.htm View this thread: http://forums.techarena.in/server-scripting/1126498.htmhttp://forums.techarena.in
Author
19 Feb 2009 8:40 PM
Pegasus (MVP)
I had tested the script you posted, same as Al Dunbar, and it ran just fine,
same as with Al. This draws me to one of two conclusions:
- You're not posting the script that causes the problem.
- The problem is reported by a different script than what you think.

Put some markers of the form
wscript.echo "Label 1"
wscript.echo "Label 2"
into your script so that you can see where the problem occurs!


Show quoteHide quote
"prezpwns" <prezpwns.3nvdfd@DoNotSpam.com> wrote in message
news:prezpwns.3nvdfd@DoNotSpam.com...
>
> Sorry - i suppose that would be helpful:
>
> Line: 11 (Set objShell)
> Char: 1
> Code:800a01f4
> Source: MicrosoftVBscript Runtime error
>
>
> --
> prezpwns
> ------------------------------------------------------------------------
> prezpwns's Profile: http://forums.techarena.in/members/prezpwns.htm
> View this thread: http://forums.techarena.in/server-scripting/1126498.htm
>
> http://forums.techarena.in
>
Author
19 Feb 2009 8:44 PM
Richard Mueller [MVP]
"prezpwns" <prezpwns.3nvdfd@DoNotSpam.com> wrote in message
news:prezpwns.3nvdfd@DoNotSpam.com...
>
> Sorry - i suppose that would be helpful:
>
> Line: 11 (Set objShell)
> Char: 1
> Code:800a01f4
> Source: MicrosoftVBscript Runtime error
>

Can't duplicate the error. We must not be seeing all of the script. The "Set
objShell" statement seems to be on line 7 in what you posted.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

Bookmark and Share

Post Thread options