[THIN] Re: OT: VBScript assistance needed

  • From: Steve Snyder <kwajalein@xxxxxxxxx>
  • To: thin@xxxxxxxxxxxxx
  • Date: Tue, 5 May 2009 10:30:00 +1200

ah, judicious use of "on error resume next" got me by this one...

On Tue, May 5, 2009 at 10:09 AM, Steve Snyder <kwajalein@xxxxxxxxx> wrote:

> alright, new vbscript question
>
> reading command line arguments ala
>
> dim objargs
> set objargs = wscript.arguments
>
> which works fine. But, I want to be able to test whether objargs got
> populated or not since if it didn't and I try to reference objargs(0) I'll
> get nasty errors. I've tried testing it with isarray, isempty, isnull,
> isobject, ubound and they all give the same result regardless of whether or
> not the array was populated.
>
> any ideas?
>
>
> On Wed, Apr 29, 2009 at 8:33 AM, Steve Snyder <kwajalein@xxxxxxxxx> wrote:
>
>> I had tunnel vision I guess....
>>
>> But yep, that works much better - 2 platforms, 1 script.
>>
>>
>> On Tue, Apr 28, 2009 at 9:52 PM, Jeremy Saunders <
>> Jeremy.Saunders@xxxxxxxxxxxxxx> wrote:
>>
>>>  J Good point. He asked for logoff in a vbscript. I just looked at it
>>> differently…but you’ve asked the obvious question.
>>>
>>>
>>>
>>> *From:* thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] *On
>>> Behalf Of *Braebaum, Neil
>>> *Sent:* Tuesday, April 28, 2009 5:03 PM
>>> *To:* thin@xxxxxxxxxxxxx
>>> *Subject:* [THIN] Re: OT: VBScript assistance needed
>>>
>>>
>>>
>>> Unless there's loads of other things to do by script, why not either just
>>> call logoff.exe directly, or in a command file:-
>>>
>>>
>>>
>>> cmd.exe /c logoff.exe
>>>
>>>
>>>
>>> ?
>>>
>>>
>>>
>>> Is there other stuff not included that has to be done by vbscript? 'cos
>>> otherwise, I'm seeing loads of lines for one command.
>>>
>>>
>>>
>>> Neil
>>>
>>>
>>>  ------------------------------
>>>
>>> *From:* thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] *On
>>> Behalf Of *Jeremy Saunders
>>> *Sent:* 28 April 2009 09:59
>>>
>>> *To:* thin@xxxxxxxxxxxxx
>>> *Subject:* [THIN] Re: OT: VBScript assistance needed
>>>
>>> I’ve not tested this…just put it together in Notepad, but why don’t you
>>> just use the Run method to execute logoff.exe?
>>>
>>> Option Explicit
>>>
>>> Dim objshell
>>>
>>> Set objshell = WScript.CreateObject ("WScript.Shell")
>>>
>>> objShell.Run "cmd.exe /c logoff.exe"
>>>
>>> Set objshell = Nothing
>>>
>>> wscript.quit(0)
>>>
>>> Cheers,
>>>
>>> Jeremy.
>>>
>>> *From:* thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] *On
>>> Behalf Of *Andrew Wood
>>> *Sent:* Tuesday, April 28, 2009 4:34 PM
>>> *To:* thin@xxxxxxxxxxxxx
>>> *Subject:* [THIN] Re: OT: VBScript assistance needed
>>>
>>> Is this a pure TS environment? If you’ve Ctx you could use MFCOM you
>>> could do :-
>>>
>>> For each asession in oMFServer.Sessions
>>>
>>>                 Assession.logoff(false)
>>>
>>> Next
>>>
>>> Where oMFServer is an metaframecom.metaframeserver object for the current
>>> machine
>>>
>>> Failing that you could always enumerate the sessions and run a logoff
>>> command for each one.
>>>
>>> *From:* thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] *On
>>> Behalf Of *Steve Snyder
>>> *Sent:* 28 April 2009 02:13
>>> *To:* thin@xxxxxxxxxxxxx
>>> *Subject:* [THIN] OT: VBScript assistance needed
>>>
>>> trying to implement a logoff in vbscript, a la
>>>
>>> set objOS -
>>> getobject("winmgmts:{(Shutdown)}//.root/cimv2").execquery("select * from
>>> win32_operatingsystem where primary=true")
>>> for each objsys in objOS
>>>   objsys.win32shutdown 0
>>> next
>>>
>>>  which works great on a 32bit windows system, not so great on a 64bit
>>> windows system. Any ideas how to make this fly on 64bit?
>>>  ------------------------------
>>>
>>> *Confidentiality and Privilege Notice **
>>> *This document is intended solely for the named addressee.  The
>>> information contained in the pages is confidential and contains legally
>>> privileged information. If you are not the addressee indicated in this
>>> message (or responsible for delivery of the message to such person), you may
>>> not copy or deliver this message to anyone, and you should destroy this
>>> message and kindly notify the sender by reply email. Confidentiality and
>>> legal privilege are not waived or lost by reason of mistaken delivery to
>>> you.
>>>  ------------------------------
>>>
>>>
>>>
>>> ********************************************************************************
>>>
>>>
>>> This email and its attachments are confidential to the intended
>>> recipient. If this has come to you in error, please notify the sender
>>> immediately and delete this email from your system. You must take no action
>>> based on this email, nor must you copy or disclose it or any part of its
>>> contents to any person or organisation. Please note that email
>>> communications may be monitored. The registered office of Shop Direct
>>> Limited is First Floor, Skyways House, Speke Road, Speke, Liverpool, L70
>>> 1AB, registered number 04730752.
>>>
>>> Subsidiary companies of Shop Direct Limited include:
>>>
>>> Shop Direct Group Financial Services Limited (SDGFS), Shop Direct
>>> Financial Services Limited (SDFS) and Shop Direct Finance Company Limited
>>> (SDFC). The registered office of SDGFS, SDFS and SDFC is Aintree Innovation
>>> Centre, Park Lane, Netherton, Bootle, L30 1SL, registered numbers 05200103
>>> (SDGFS), 04730706 (SDFS) and 04660974 (SDFC). SDFS and SDFC are authorised
>>> and regulated by the Financial Services Authority in respect of arranging
>>> insurance products.
>>>
>>> Shop Direct Contact Centres Limited (SDCC) and Shop Direct Home Shopping
>>> Limited (SDHS). The registered office of SDCC and SDHS is First Floor,
>>> Skyways House, Speke Road, Speke, Liverpool, L70 1AB, registered numbers
>>> 05330323 (SDCC), 04663281 (SDHS).
>>>
>>> All companies registered in England.
>>>
>>> ********************************************************************************
>>>
>>>  ------------------------------
>>>  *Confidentiality and Privilege Notice
>>> *This document is intended solely for the named addressee.  The
>>> information contained in the pages is confidential and contains legally
>>> privileged information. If you are not the addressee indicated in this
>>> message (or responsible for delivery of the message to such person), you may
>>> not copy or deliver this message to anyone, and you should destroy this
>>> message and kindly notify the sender by reply email. Confidentiality and
>>> legal privilege are not waived or lost by reason of mistaken delivery to
>>> you.
>>>  ------------------------------
>>>
>>
>>
>

Other related posts: