From: harry richards on
This is not a coding issue. They are sending you down the wrong path in giving you code that works on other machines. I have Vista Ultimate and it does not run out of the box. You have to correct Vista. I fixed it a couple of years ago and I am trying to remember how I did it. At that time I downloaded either a wscript or powershell download. I have since found out you don't need to do that.

I am now thinking it is a setting or other that is blocking the execution of the code. So far I have not found any reference to it. I have found many posts of others offering working code as well.

Now that I set you in the right direction, hopefully between the two of us, one of us will find the solution.


> On Thursday, August 14, 2008 6:55 PM L wrote:

> The following code works on a XP machine but does not work on vista. The
> error message I get is "The parameter is incorrect."
>
> Set objShell = CreateObject("Shell.Application")
> objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName &
> Chr(34) & " Run", , "runas", 1
>
> Thanks,
> LT


>> On Thursday, August 14, 2008 8:30 PM PaulM wrote:

>> Try this:
>>
>> If WScript.Arguments.length = 0 Then
>> Set objShell = CreateObject("Shell.Application")
>> objShell.ShellExecute "wscript.exe", """" & _
>> WScript.ScriptFullName & """" &_
>> " RunAsAdministrator", , "runas", 1
>> Else
>>
>> --
>> ---------------------------------------------------------------------------------
>> www.paulsxp.com
>> www.paulsxp.com/forum
>> www.supportspace.com/home/home.s2?aiu=paulm
>> ---------------------------------------------------------------------------------
>>
>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>> news:8865B042-6AC5-4672-83F7-60310E837F19(a)microsoft.com...


>>> On Friday, August 15, 2008 1:06 PM L wrote:

>>> Thanks Paul!
>>>
>>> I tried your code as well. Did NOT work either. Running on Vista Home
>>> Edition SP1
>>>
>>> Thanks,
>>> LT
>>> "PaulM" wrote:


>>>> On Friday, August 15, 2008 1:20 PM PaulM wrote:

>>>> Here is a sample script that will Enable the Control Panel.
>>>> Watch for word wrap.
>>>>
>>>>
>>>> 'Enable Control Panel
>>>> Option Explicit
>>>> Dim WshShell, ObjShell, X, Message
>>>>
>>>> Set WshShell = WScript.CreateObject("WScript.Shell")
>>>> If WScript.Arguments.length =0 Then
>>>> Set objShell = CreateObject("Shell.Application")
>>>> objShell.ShellExecute "wscript.exe", """" & _
>>>> WScript.ScriptFullName & """" & " uac","", "runas", 1
>>>> Else
>>>>
>>>> Message = "This script will Enable Control Panel." & vbCr & vbCr
>>>> Message = Message & "You must LogOff/On for this change to take effect." &
>>>> vbCr & vbCr
>>>> Message = Message & "Adding information can unintentionally change or delete
>>>> values" & vbCr
>>>> Message = Message & "and cause components to stop working correctly." & vbCr
>>>> Message = Message & "If you do not trust the source of this information, do
>>>> not add it to the registry." & vbCr & vbCr
>>>> Message = Message & "Are you sure you want to continue?"
>>>>
>>>> X = MsgBox(Message, vbYesNo + vbExclamation, "Paul's XP and Vista Tweaks")
>>>> If X = 6 Then
>>>>
>>>> WshShell.RegWrite
>>>> "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoControlPanel",
>>>> 0, "REG_DWORD"
>>>>
>>>> Message = "Control Panel is now ENABLED!" & vbCr & vbCr
>>>> Message = Message & "Don't forget to LogOff/On for this change to take
>>>> effect." & vbCr & vbCr
>>>> Message = Message & "This script was downloaded from www.paulsxp.com."
>>>> MsgBox Message,64, "Done!"
>>>>
>>>> End If
>>>> End If
>>>>
>>>>
>>>> --
>>>> ---------------------------------------------------------------------------------
>>>> www.paulsxp.com
>>>> www.paulsxp.com/forum
>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>> ---------------------------------------------------------------------------------
>>>>
>>>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>>>> news:ABEB3EA3-6E80-475E-9680-06067CB0383D(a)microsoft.com...


>>>>> On Friday, August 15, 2008 1:50 PM L wrote:

>>>>> Thanks Paul,
>>>>> I stil get that "C:\Windows\system32\wscript.exe The parameter is
>>>>> incorrect." error. I copied and pasted your entire script as the result was
>>>>> the same error message.
>>>>>
>>>>> In my script, I m reading and writing a file and alot of other stuff. Whats
>>>>> strange is everything else works except for the .ShellExecute call. And the
>>>>> same call to .ShellExecute works on XP sp3. At this point both XP and Vista
>>>>> have same version of Wscript.
>>>>> Btw, where can I find the offical syntax for .ShellExecute in vbs (in terms
>>>>> of passing parameters. I wasn't able to find the docs for the syntax in vbs
>>>>> either).
>>>>> Thanks again for your help.
>>>>> LT
>>>>>
>>>>> "PaulM" wrote:


>>>>>> On Friday, August 15, 2008 2:31 PM PaulM wrote:

>>>>>> My Wscript.exe in XP is 5.6.0.8820, Vista is 5.7.0.18068.
>>>>>>
>>>>>> This is what I have on ShellExcute:
>>>>>> http://www.taskghost.com/api/shell_execute.htm
>>>>>>
>>>>>> I have lots of script for Vista and they all work, no problem.
>>>>>>
>>>>>> --
>>>>>> ---------------------------------------------------------------------------------
>>>>>> www.paulsxp.com
>>>>>> www.paulsxp.com/forum
>>>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>>>> ---------------------------------------------------------------------------------
>>>>>>
>>>>>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>>>>>> news:437D78AC-8D65-42C6-AEF8-EBDA6D33825F(a)microsoft.com...


>>>>>>> On Friday, August 15, 2008 6:11 PM L wrote:

>>>>>>> My Vista wscript version is exactly same 5.7.0.18068.
>>>>>>> XP version is 5.7.0.18066(and the script works on XP).
>>>>>>>
>>>>>>> I logged in under admin and standard users in Vista but that doesn't help.
>>>>>>>
>>>>>>> All I need to accomplish is to create a shortcut on all user desktop. The
>>>>>>> shortcut doesn't get created as i think UAC is not elevated. Is there any
>>>>>>> other workaround?
>>>>>>>
>>>>>>> Thanks for your help Paul.
>>>>>>> LT
>>>>>>>
>>>>>>> "PaulM" wrote:


>>>>>>>> On Friday, August 15, 2008 7:43 PM PaulM wrote:

>>>>>>>> That???s the only way I know of. Can I have a look at your script?
>>>>>>>>
>>>>>>>> --
>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>> www.paulsxp.com
>>>>>>>> www.paulsxp.com/forum
>>>>>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>
>>>>>>>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>>>>>>>> news:C2E4A40D-EA26-4939-B1C9-2D2018602A20(a)microsoft.com...


>>>>>>>>> On Monday, August 18, 2008 12:05 PM L wrote:

>>>>>>>>> This is the script i'm having issues running on vista:
>>>>>>>>>
>>>>>>>>> set WshShell = WScript.CreateObject("WScript.Shell")
>>>>>>>>> strAllDesktopVista = WshShell.Environment("Process").Item("PUBLIC") &
>>>>>>>>> "\Desktop"
>>>>>>>>> strAllDesktopXP = WshShell.ExpandEnvironmentStrings("%AllUsersProfile%") &
>>>>>>>>> "\Desktop"
>>>>>>>>> strURL = "http://www.google.com"
>>>>>>>>> strFileName = strAllDesktopVista & "\google.lnk"
>>>>>>>>>
>>>>>>>>> Set objShell = CreateObject("Shell.Application")
>>>>>>>>> objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName &
>>>>>>>>> Chr(34) & " Run", , "runas", 1
>>>>>>>>>
>>>>>>>>> On Error Resume Next
>>>>>>>>> Set myShortcutAllDesktopVista = WshShell.CreateShortcut(strFileName)
>>>>>>>>> myShortcutAllDesktopVista.TargetPath = strURL
>>>>>>>>> myShortcutAllDesktopVista.Save
>>>>>>>>>
>>>>>>>>> strFileName = strAllDesktopXP & "\google.lnk"
>>>>>>>>> Set myShortcutDesktopXP = WshShell.CreateShortcut(strFileName)
>>>>>>>>> myShortcutDesktopXP.TargetPath = strURL
>>>>>>>>> myShortcutDesktopXP.Save
>>>>>>>>> WScript.Quit
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks Paul
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> "PaulM" wrote:


>>>>>>>>>> On Monday, August 18, 2008 1:16 PM PaulM wrote:

>>>>>>>>>> Here is your script, all I did was change a couple of lines and it works
>>>>>>>>>> great here. It the google short cut on the desktop.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Set WshShell = WScript.CreateObject("WScript.Shell")
>>>>>>>>>> strAllDesktopVista = WshShell.Environment("Process").Item("PUBLIC") &
>>>>>>>>>> "\Desktop"
>>>>>>>>>> strAllDesktopXP = WshShell.ExpandEnvironmentStrings("%AllUsersProfile%") &
>>>>>>>>>> "\Desktop"
>>>>>>>>>> strURL = "http://www.google.com"
>>>>>>>>>> strFileName = strAllDesktopVista & "\google.lnk"
>>>>>>>>>>
>>>>>>>>>> If WScript.Arguments.length = 0 Then
>>>>>>>>>> Set objShell = CreateObject("Shell.Application")
>>>>>>>>>> objShell.ShellExecute "wscript.exe", """" & _
>>>>>>>>>> WScript.ScriptFullName & """" &_
>>>>>>>>>> " RunAsAdministrator", , "runas", 1
>>>>>>>>>>
>>>>>>>>>> On Error Resume Next
>>>>>>>>>> Set myShortcutAllDesktopVista = WshShell.CreateShortcut(strFileName)
>>>>>>>>>> myShortcutAllDesktopVista.TargetPath = strURL
>>>>>>>>>> myShortcutAllDesktopVista.Save
>>>>>>>>>>
>>>>>>>>>> strFileName = strAllDesktopXP & "\google.lnk"
>>>>>>>>>> Set myShortcutDesktopXP = WshShell.CreateShortcut(strFileName)
>>>>>>>>>> myShortcutDesktopXP.TargetPath = strURL
>>>>>>>>>> myShortcutDesktopXP.Save
>>>>>>>>>>
>>>>>>>>>> End If
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>> www.paulsxp.com
>>>>>>>>>> www.paulsxp.com/forum
>>>>>>>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>>>>>>>>>> news:EF86C4C4-64EF-47DB-A40A-2EB9E1A5A085(a)microsoft.com...


>>>>>>>>>>> On Monday, August 18, 2008 3:10 PM L wrote:

>>>>>>>>>>> Paul really appreciate your help!
>>>>>>>>>>>
>>>>>>>>>>> I just copied and pasted the script with your changes and I still get that
>>>>>>>>>>> "The paramter is incorrect." Error.
>>>>>>>>>>> I tried on different machines running different versions of vista and there
>>>>>>>>>>> is always an error.
>>>>>>>>>>> Thanks again,
>>>>>>>>>>> LT
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> "PaulM" wrote:


>>>>>>>>>>>> On Monday, August 18, 2008 4:32 PM PaulM wrote:

>>>>>>>>>>>> Well I do not know where your problem is, but I run this script on 3
>>>>>>>>>>>> computer and all went well.
>>>>>>>>>>>> As it stands right now, you can not run any vbscript on your computer,
>>>>>>>>>>>> right?
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>> www.paulsxp.com
>>>>>>>>>>>> www.paulsxp.com/forum
>>>>>>>>>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>>
>>>>>>>>>>>> "PaulM" <paul(a)paulsxp.com> wrote in message
>>>>>>>>>>>> news:OTwvxYVAJHA.1224(a)TK2MSFTNGP02.phx.gbl...


>>>>>>>>>>>>> On Monday, August 18, 2008 5:14 PM L wrote:

>>>>>>>>>>>>> I can run any other vbscript on the same machines except this line
>>>>>>>>>>>>> "objShell.ShellExecute "wscript.exe", .............." and thats where the
>>>>>>>>>>>>> problem exists. Like if I have msgbox etc in the script, it works. BTw, I'm
>>>>>>>>>>>>> referring to Vista machines which are having the problem with
>>>>>>>>>>>>> "objShell.ShellExecute "wscript.exe", .............." And again, they can
>>>>>>>>>>>>> run any other portion of vbs except .shellExecute and the error I get is "The
>>>>>>>>>>>>> parameter is incorrect." Also, on XP, everything works fine(even the above
>>>>>>>>>>>>> line).
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>
>>>>>>>>>>>>> "PaulM" wrote:


>>>>>>>>>>>>>> On Monday, August 18, 2008 5:31 PM PaulM wrote:

>>>>>>>>>>>>>> Wow I don't know what to say any more. Users have download lots of my script
>>>>>>>>>>>>>> with objShell.ShellExecute "wscript.exe" for Vista and all of them work.
>>>>>>>>>>>>>> Some where your Vista OS is messed up. Oh well. Have you tried the script
>>>>>>>>>>>>>> with:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dim WshShell, ObjShell
>>>>>>>>>>>>>> Set WshShell = WScript.CreateObject("WScript.Shell")
>>>>>>>>>>>>>> strAllDesktopVista = WshShell.Environment("Process").Item("PUBLIC") &
>>>>>>>>>>>>>> "\Desktop"
>>>>>>>>>>>>>> strAllDesktopXP = WshShell.ExpandEnvironmentStrings("%AllUsersProfile%") &
>>>>>>>>>>>>>> "\Desktop"
>>>>>>>>>>>>>> strURL = "http://www.google.com"
>>>>>>>>>>>>>> strFileName = strAllDesktopVista & "\google.lnk"
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> If WScript.Arguments.length = 0 Then
>>>>>>>>>>>>>> Set objShell = CreateObject("Shell.Application")
>>>>>>>>>>>>>> objShell.ShellExecute "wscript.exe", """" & _
>>>>>>>>>>>>>> WScript.ScriptFullName & """" &_
>>>>>>>>>>>>>> " RunAsAdministrator", , "runas", 1
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 'On Error Resume Next
>>>>>>>>>>>>>> Set myShortcutAllDesktopVista = WshShell.CreateShortcut(strFileName)
>>>>>>>>>>>>>> myShortcutAllDesktopVista.TargetPath = strURL
>>>>>>>>>>>>>> myShortcutAllDesktopVista.Save
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> strFileName = strAllDesktopXP & "\google.lnk"
>>>>>>>>>>>>>> Set myShortcutDesktopXP = WshShell.CreateShortcut(strFileName)
>>>>>>>>>>>>>> myShortcutDesktopXP.TargetPath = strURL
>>>>>>>>>>>>>> myShortcutDesktopXP.Save
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> End If
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>>>> www.paulsxp.com
>>>>>>>>>>>>>> www.paulsxp.com/forum
>>>>>>>>>>>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>>>>>>>>>>>>>> news:03B5E194-B1B2-4E09-8CE8-3A02464BE352(a)microsoft.com...


>>>>>>>>>>>>>>> On Monday, August 18, 2008 6:22 PM L wrote:

>>>>>>>>>>>>>>> This does not work either.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> "PaulM" wrote:


>>>>>>>>>>>>>>>> On Monday, August 18, 2008 7:36 PM PaulM wrote:

>>>>>>>>>>>>>>>> Well let me know if you get it to work and if you find out why it did not
>>>>>>>>>>>>>>>> work.
>>>>>>>>>>>>>>>> If I was there I would get it to work, but it is real hard doing it this
>>>>>>>>>>>>>>>> way.
>>>>>>>>>>>>>>>> Good Luck.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>>>>>> www.paulsxp.com
>>>>>>>>>>>>>>>> www.paulsxp.com/forum
>>>>>>>>>>>>>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>>>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>>>>>>>>>>>>>>>> news:1C0501B8-837F-48B6-9524-B596838DECF7(a)microsoft.com...


>>>>>>>>>>>>>>>>> On Monday, August 18, 2008 7:52 PM L wrote:

>>>>>>>>>>>>>>>>> Yeah, beat me. I m not much into scripting. Just happen to do it for creating
>>>>>>>>>>>>>>>>> shortcuts. Since I can get it to work for individual user accounts that
>>>>>>>>>>>>>>>>> suffices the requirements for now. And if I do get it to work, I will let you
>>>>>>>>>>>>>>>>> know.
>>>>>>>>>>>>>>>>> I am leaning towards users account settings which maybe the problem but no
>>>>>>>>>>>>>>>>> sure as this is the first time I m interacting with Vista.
>>>>>>>>>>>>>>>>> Anyways, really appreciate all your help.
>>>>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>>>>>> LT
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> "PaulM" wrote:


>>>>>>>>>>>>>>>>>> On Monday, August 18, 2008 8:18 PM PaulM wrote:

>>>>>>>>>>>>>>>>>> You are Welcome.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>>>>>>>> www.paulsxp.com
>>>>>>>>>>>>>>>>>> www.paulsxp.com/forum
>>>>>>>>>>>>>>>>>> www.supportspace.com/home/home.s2?aiu=paulm
>>>>>>>>>>>>>>>>>> ---------------------------------------------------------------------------------
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> "LT" <LT(a)discussions.microsoft.com> wrote in message
>>>>>>>>>>>>>>>>>> news:CF16F9F2-74B4-4042-90C6-03262A598F1B(a)microsoft.com...


>>>>>>>>>>>>>>>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>>>>>>>>>>>>>>>> WPF Control?s Default Style or Template by Extending the WPF Designer in Visual Studio 2010
>>>>>>>>>>>>>>>>>> http://www.eggheadcafe.com/tutorials/aspnet/d1ad0a33-d815-4083-8e97-c234fd661095/wpf-controls-default-style-or-template-by-extending-the-wpf-designer-in-visual-studio-2010.aspx