|
|
|||||||
I have a script that I am trying to turn into an exe file, which works fine until I try to use /runasuser /runaspassword. I get the following error message: ERROR: unexpected command! Script: C:\DOCUME~1\ [...]\ke2~1000842\k2erun.dat Line: 112 Does anyone have any idea what may be going on here? I haven't used kix2exe before now, and don't know how to go about troubleshooting this issue. Thanks, Shawn |
||||||||
|
|
|||||||
Can you show us the script or at least the section that is having the problem. |
||||||||
|
|
|||||||
That's the trouble I'm having, since I can't actually see what's at line 112 in the script. My original script doesn't even have 100 lines. Here's the script anyway: Break On Dim $Sessions[60,2] Dim $line Dim $x Dim $RadioButtons[60] Dim $session ; Run qwinsta to enumerate sessions SHELL "%comspec% /c qwinsta.exe /server:nmmtermserv01 > userlist.txt" ; Parse the session list $x = 0 IF OPEN (10, "userlist.txt") = 0 $line = READLINE(10) $line = READLINE(10) $line = READLINE(10) $line = READLINE(10) WHILE @ERROR = 0 $Sessions[$x,0] = RTrim(SubStr($line,20,20)) $Sessions[$x,1] = LTrim(SubStr($line,42,5)) ;? "Username:" + $Sessions[x,0] + " Session ID: " + $Sessions[x,1] $line = ReadLine(10) $x = $x + 1 LOOP ENDIF $nul = CLOSE(10) DEL "userlist.txt" $session = 10000 ; Display form with KixForms $Form = CreateObject("Kixtart.Form") $Form.FontName = "Tahoma" $Form.FontSize = 10 $Form.FormBorderStyle = 4 $Form.SizeGripStyle = 1 $Form.Size = 600,500 $Form.Text = "Reset GP Terminal Session" $Form.tag = 0 $GroupBox = $Form.Controls.Add("GroupBox") $GroupBox.Top = 10 $GroupBox.Left = 10 $GroupBox.Height = $Form.Height - 110 $GroupBox.Width = $Form.Width - 20 $y = 10 For $x = 0 To 59 If $Sessions[$x,0] <> "" $RadioButtons[$x] = $GroupBox.Controls.Add("RadioButton") $RadioButtons[$x].Top = $y + (($x mod 15) * $RadioButtons[x].Height) $RadioButtons[$x].Left = 10 + (120 * ($x / 15)) $RadioButtons[$x].Name = $Sessions[$x,0] $RadioButtons[$x].Text = $Sessions[$x,0] $RadioButtons[$x].Width = 120 $RadioButtons[$x].OnClick = "$$session = $Sessions[$x,1]" EndIf Next $Button = $Form.ToolButton $Button.Top = $Form.ClientHeight - $Button.Height - 10 $Button.Left = $Form.ClientWidth - $Button.Width - 10 $Button.Text = "Reset" $Button.Icon = 37 $Button.OnClick = "$$form.tag=1" $Button.Anchor = 2+8 $Form.Center $Form.Show While $Form.Visible and $form.tag = "0" $= Execute($Form.DoEvents) Loop if $form.tag = "1" RUN "%comspec% /c RESET SESSION $session /server:nmmtermserv01" else endif Exit 0 |
||||||||
|
|
|||||||
Hmmm, looking at this a little more and I think it has something to do with the unregistering of the kixforms (?) |
||||||||
|
|
|||||||
I did not look at the code in details but not having kixforms registered might be it. Depending on for what kixforms you wrote the script each workstation you want to run this script on should have either the kixform.classic dll or the kixform.net dll registered. |
||||||||
|
|
|||||||
I use something like the following to register KiXforms. If the object cannot be created the UDF attempts to use a local copy to register it. Useful for deploying one-off tools to tech support staff - if they get an error they know that they just need to re-run the script with a privileged account.
|
||||||||
|
|
|||||||
Hi, That seems to have solved my problem! Although, I found that I have to have kixforms.dll registered on the machine BEFOREHAND, even though the user credentials I'm using to run the script (with /runasuser) should have admin rights to the local workstation. Anyway, thanks everyone for your help! Shawn |
||||||||
|
|
|||||||
You can register the kixforms dll (classic and .net) with a start up script or deploy them with a GPO. |
||||||||
|
|
|||||||
Originally Posted By: Mart You can register the kixforms dll (classic and .net) with a start up script or deploy them with a GPO. It would need to be either a GPO or something like RunNas or the user would need Admin rights. You can quasi reg the classic with Power User rights but to properly do it you should have Admin rights. If the user has rights or you're using RunNas you can actually add checking and installing code at the beginning of your code and not run the rest until it is installed and it should work as I recall (have not done anything like that type of testing though in many years) |
||||||||
|
|
|||||||
I have to disagree with you Doc. Registering the classic dll with a start-up script works just fine. Ok it a BATch start-up script but that doesn't matter. Did this for many years until several months ago I implemented a KF.NET based logon script and you should use regasm instead of regsvr32. But I just took the easy way out and made a GPO that deploys the KF.NET MSI. Works just fine, no problems whatsoever. No need for power user or admin rights. Start-up scripts runs on the local system account so it should have local admin rights. If it is part of the logon script then some kind of elevated rights are needed indeed. |
||||||||
|
|
|||||||
Don't think we're in disagreement. I just left out the StartUp script which as you say is essentially the same, but in both cases it has Admin rights. I was attempting to point out that installing it with only normal user or Power User would either fail or partially fail. |
||||||||
|
|
|||||||
And (computer) Startup Scripts are part of a GPO, so I presume that you both agree |
||||||||
|
|
|||||||
Ahhh, ok. Sorry Doc. I misunderstood. |