Re: VBS Logon and move computer script

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Adrian Marsh (NNTP) (marsh_removeme__at_lucent.com)
Date: 11/24/04


Date: Wed, 24 Nov 2004 15:14:51 +0000

Richard,

Could you take a look at the following lines and tell me if you can see
an obvious problem?

I switched over the Computer scripts, and it works for actually moving
the PC account, but when its finished and rebooted I get a message
saying cmd.exe had failed, and then I have subsequent problems with
other programs. If I take this script out of the login process, those
problems go away.

If I run this script manually from a cmd.exe/cscript prompt, I get :

"Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

\\swocmpq02\software$\_logon\_moveaccount.vbs(3, 1) (null): There is no
such object on the server."

Which is correct I guess, but how can I make the error message go
away??? If I put that PC back into Computers, then no error occurs..
Is there another way of doing the same thing??

Top of script:

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set currentAccount = GetObject("LDAP://CN=" & strComputer &
",CN=Computers,DC=uk-lab,DC=lucent,DC=com")

If not currentAccount is Nothing Then
.....

Richard Mueller [MVP] wrote:
> Hi,
>
> If all of your clients are W2k or above, it might be better to run this as
> StartUp script (using Group Policy). StartUp scripts run with System
> privileges, which might be enough for you. There is no user, but you can
> manipulate the computer account.
>
> A program running on the client cannot reboot the machine and then continue
> running. I would suggest that you find a way to detect that the tasks in
> Script A are complete. This might be checking the location of the computer
> object. Or, you might have to save a "flag" file on the hard drive
> indicating that the tasks in Script A are complete. Then, the next time the
> machine starts (after the reboot), the program would check first to see if
> Script A is complete. If so, continue with the tasks in Script B and C.
>
> In fact, there should also be a flag to indicate when all the tasks are
> complete. When the program starts, if it detects this final flag, it knows
> everthing has been done and exits.
>
> The flag can be the existence of a file, a registry entry, the value of an
> AD attribute (of the computer object), or perhaps the location of the
> computer object. Otherwise, you have make sure it is OK for the program to
> run repeatedly.
>



Relevant Pages

  • Re: changing existing local user flag "never expires"
    ... set the flag "password never expires". ... A non-zero result means that the flag is ... which means that the script results in the flag not being ... If (lngFlags And ADS_UF_DONT_EXPIRE_PASSWD) = 0 Then ...
    (microsoft.public.scripting.vbscript)
  • Go to related records then find a subset
    ... my deepest condolences for what it is happening today in London. ... Find script step that includes all the desired parameters + the flag ... showing the records, I need to reset the flag field, so that it is ...
    (comp.databases.filemaker)
  • Re: VBscript to set the inherit permissions in registry
    ... propogate to this object" on a workstation from a script. ... Dim objUser, objNtSecurityDescriptor, intNtSecurityDescriptorControl ... ' Save control settings in the security descriptor object. ... As with all flag settings, you "And" the property with the appropriate bit ...
    (microsoft.public.scripting.vbscript)
  • Re: Startup Script install software
    ... I granted the computer account everything but full permissions. ... the startup script so I can use the local system rights for the install, ... My script works if you run it manually so I ... It does allow my script to create a flag in ...
    (microsoft.public.windows.server.active_directory)
  • Re: how to call a function when somebody click a link?
    ... and the php script call the function only if the flag is set:) ... //we want user to go on this page and to add a flag which cause PHP to ... data's been sent to client's browser. ...
    (comp.lang.php)