Page 1 of 1 1
Topic Options
#153730 - 2005-12-20 07:47 PM $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
Hi guys and gals.!

It's been a while since I was last here, so I am a little rusty.!

I have a function that looks alot like the wshShortcut UDF (http://www.kixtart.org/ubbthreads/showflat.php?Number=83318)

However, the problem I have is that the particular line that create the shell object does not always work.

Everytime I run my script, it may work, it may not.

I have tried adding...

Code:
 
$oShell = CreateObject("WScript.Shell")

If NOT $oShell
$oShell = 0
$oShell = CreateObject("WScript.Shell")
If NOT $oShell
MessageBox("There was an error creating your Start Menu and Desktop shortcuts." + "@CRLF" +
"Please contact a systems administrator.", "Error...", 48)
Exit
EndIf
EndIf



But it still doesn't work.
Does anyone have any ideas.?

Oh, I'm running Kix v2010.

Thanks
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153731 - 2005-12-20 07:51 PM Re: $shell = createobject("wscript.shell") not working as it should...
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Hee Wiz!

It seems that all oldtime members are getting back to KORG...
_________________________
Co


Top
#153732 - 2005-12-20 07:54 PM Re: $shell = createobject("wscript.shell") not working as it should...
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What does the following yield on a failure?
Code:
    $oShell = CreateObject("WScript.Shell")
? @error + " " + @serror
? "VarType = " + vartypename($oShell)

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#153733 - 2005-12-20 11:47 PM Re: $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
Howard, I'll let you know in the morning when I try again.

Thanks
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153734 - 2005-12-21 11:22 AM Re: $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
OK, the error gives...

-2147024769 The specified procedure could not be found
VarType = Empty


Is there another way of creating shortcuts, that does not use WSH or the built-in ADDPROGRAMITEM function.?

I have seen one other UDF (softlink), but that failed completely for me.!


Wiz


Edited by Wizard (2005-12-21 12:41 PM)
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153735 - 2005-12-21 11:55 AM Re: $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
I have also just found this...

http://www.adminlife.com/247reference/msgs/9/49074.aspx

but since I am working as a consultant for a company, I can't really get them to test this for me.!
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153736 - 2005-12-21 06:26 PM Re: $shell = createobject("wscript.shell") not working as it should...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Quote:

I have seen one other UDF (softlink), but that failed completely for me.!






I don't see how that could be. Perhaps you were unable to get the right syntax of the command or something of that nature.

Please give it another try and add some @SERROR stuff to the code if needed. It should work just fine.
 

SoftLink() - Creates a shortcut anywhere
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=82353
 

Top
#153737 - 2005-12-22 12:46 PM Re: $shell = createobject("wscript.shell") not working as it should...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
fixed the udf.
dunno how, but the udf just stopped working as it surely worked before
_________________________
!

download KiXnet

Top
#153738 - 2005-12-22 02:01 PM Re: $shell = createobject("wscript.shell") not working as it should...
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Sounds to me like your VBS or the COM CreateObject functionality is corrupt or missing. Try using CreateObject for a different non-VBS object and see if it also fails. If not, the try reinstalling VBS and see what happens.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#153739 - 2005-12-22 03:14 PM Re: $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
Quote:

Sounds to me like you VBS or the COM CreateObject functionality is corrupt or missing.




Usually I would agree, but this problem on happens every other time. It works perfectly well once, but run it again and it fails.! Run it again and it'll work, etc...

That's the annoying thing - if it constantly failed then yes we would have an issue with VBS/COM, but its not.

Wiz
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153740 - 2005-12-22 03:29 PM Re: $shell = createobject("wscript.shell") not working as it should...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I agree with Howard - you got something corrupt with WScript or COM ... my gut tells me its COM but thats kinda hard to believe (maybe in the *OLE*.DLL theres an issue idk) ... i would try this:

1) Lookup WScript.Shell in HKCR

2) Open the CLSID key

3) Copy the Default Value to your clipboard.

4) Go back to the root or HKCR and ^F then paste in the key - find it.

5) Look at the InProcServer key - the default value should be something like

C:\WINNT\System32\wshom.ocx

I would check-out the file, the version, idk. I would also try creating other objects on your workstation - how well does ADSI and WMI and stuff work ?

-Shawn

Top
#153741 - 2005-12-22 03:30 PM Re: $shell = createobject("wscript.shell") not working as it should...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and your AV system is working fine?
could be a scanning tool that makes too much lag, and com createobject fails.

anyway, you can still try the new softLink()
it's a pure kixtart solution, so it should not fail.
_________________________
!

download KiXnet

Top
#153742 - 2005-12-22 07:33 PM Re: $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
thanks guys.
I won't be back on site until after the holidays, so I'll try then.

Thanks for 'fixing' the softlink Jooel.!
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153743 - 2005-12-22 08:36 PM Re: $shell = createobject("wscript.shell") not working as it should...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Found a couple minor issues with SoftLink but they should be fixed by the time you get back from vacation.

As for the COM thing, yeah I'd fix it.

You can also try installing VBScript again - quick and easy and should repair any issues with it by doing the install

Windows Script 5.6 for Windows XP and Windows 2000
http://www.microsoft.com/downloads/detai...;displaylang=en

If it's an XP system you can also run DCOMCNFG
Then drill down to Component Services, then Computers, then My Computer, then COM+ Applications and if something is not registered it should prompt and tell you and offer to register it for you.
 
Maybe run an up to date Anti-Spyware tool against the system as well.
 

Top
#153744 - 2006-01-16 02:31 PM Re: $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
Sorry to bring this up again, but I am also getting the following error message in the event log...

"
Entry Point Not Found: The procedure entry point DoOpenPipeStream could not be located in the Dynamic Linked Library ScrRun.dll
"

The script is packaged into an EXE with KiXScript Editor 1.7

W
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153745 - 2006-01-16 04:26 PM Re: $shell = createobject("wscript.shell") not working as it should...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wizard, what's the version of your scripting host?
_________________________
!

download KiXnet

Top
#153746 - 2006-01-16 07:37 PM Re: $shell = createobject("wscript.shell") not working as it should...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Please try re-installing Windows Scripting Host on the system that runs this.


Here are the downloads from Microsoft.


Windows Script 5.6 for Windows Server 2003
Version: 5.6.0.8825

http://www.microsoft.com/downloads/detai...;DisplayLang=en

Windows Script 5.6 for Windows XP and Windows 2000
Version: 5.6.0.8825

http://www.microsoft.com/downloads/detai...;DisplayLang=en

Windows Script 5.6 for Windows 98, Windows Millennium Edition, and Windows NT 4.0
Version: 5.6.0.8825

http://www.microsoft.com/downloads/detai...;displaylang=en

 

Top
#153747 - 2006-01-17 02:26 PM Re: $shell = createobject("wscript.shell") not working as it should...
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
OK, thanks guys, it was the WSH that was broken.

As a plus point, we managed to replace just the DLL with a new one and everything is working great. This saves us installing WSH on 30 servers and rebooting them all.!
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#153748 - 2006-01-17 03:06 PM Re: $shell = createobject("wscript.shell") not working as it should...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just thinking out loud...
you most likely had a windows hotfix/security fix installed in the past that screwed up the file in the first place.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.081 seconds in which 0.034 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org