• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Active Directory

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Active Directory

    Active directory question

    1. my tentative solution - I need a vb script that will run as a .bat that will create a user profile structure on a machine.



    2. the actual problem (in case I am talking balls in 1). There is an msaccess application that produces a file for export. The export is run overnight by a bat file.
    If the profiles on the machine have been cleared down, ms office opens a dialogue asking for the user to confirm initials etc. This stops the export bat from running


    TIA
    (\__/)
    (>'.'<)
    ("")("") Born to Drink. Forced to Work

    #2
    The profile gets created by the system on logon anyway.

    I might have the wrong end of the stick here?

    Comment


      #3
      Originally posted by EternalOptimist View Post
      Active directory question

      1. my tentative solution - I need a vb script that will run as a .bat that will create a user profile structure on a machine.



      2. the actual problem (in case I am talking balls in 1). There is an msaccess application that produces a file for export. The export is run overnight by a bat file.
      If the profiles on the machine have been cleared down, ms office opens a dialogue asking for the user to confirm initials etc. This stops the export bat from running


      TIA
      Leaving 1 aside (as I don't think that's the right approach) I assume from 2 that you are running your BAT file as a scheduled task?

      If so, I think the issue is that, when no user is logged in to the system, the scheduled task will run under the SYSTEM account by default (IIRC). This, I believe, requires the task to run as a service, but Access is an application; I'm not sure if it can run as a service.

      In the Task Scheduler, double-click the task to open its property sheet. On the first tab ("Task") there is a "Run as" section towards the bottom. Make sure this has the username of an account that has the necessary privileges for whatever the task has to do, then hit the "Set password" button to... well, to set the password.

      The task should then run under that account without problems. If it's still failing (or if all those things are already set), you might need to specify assorted Access command line switches in the BAT file at the point where it's started; the /nostartup one will probably be a good place to start. Then try the /user and /pwd ones, or maybe /profile.

      Comment


        #4
        Originally posted by NickFitz View Post
        Leaving 1 aside (as I don't think that's the right approach) I assume from 2 that you are running your BAT file as a scheduled task?

        If so, I think the issue is that, when no user is logged in to the system, the scheduled task will run under the SYSTEM account by default (IIRC). This, I believe, requires the task to run as a service, but Access is an application; I'm not sure if it can run as a service.

        In the Task Scheduler, double-click the task to open its property sheet. On the first tab ("Task") there is a "Run as" section towards the bottom. Make sure this has the username of an account that has the necessary privileges for whatever the task has to do, then hit the "Set password" button to... well, to set the password.

        The task should then run under that account without problems. If it's still failing (or if all those things are already set), you might need to specify assorted Access command line switches in the BAT file at the point where it's started; the /nostartup one will probably be a good place to start. Then try the /user and /pwd ones, or maybe /profile.
        thanks nick, I tried all that earlier. The problem is that the user running the app has never run office on this virtual machine, so the MSACCESS/OFFICE welcome screen is coming up to say please confirm your initials etc

        I believe at this point it creates the user folders/entries that I am on about, which I called ,erroneously,a user profile. A user would only ever see this screen once, but in the scenario I am describing, they are constantly being allocated to new virtual machines, so they are being promted frequently

        sorry for vague factor 10, but I am a dev not an infr



        (\__/)
        (>'.'<)
        ("")("") Born to Drink. Forced to Work

        Comment


          #5
          Originally posted by EternalOptimist View Post
          thanks nick, I tried all that earlier. The problem is that the user running the app has never run office on this virtual machine, so the MSACCESS/OFFICE welcome screen is coming up to say please confirm your initials etc

          I believe at this point it creates the user folders/entries that I am on about, which I called ,erroneously,a user profile. A user would only ever see this screen once, but in the scenario I am describing, they are constantly being allocated to new virtual machines, so they are being promted frequently

          sorry for vague factor 10, but I am a dev not an infr



          There's an MSKB article that might help, although it's full of caveats like "We do not recommend or support Automation to a Microsoft Office application from an unattended user account."

          Comment


            #6
            You could try making the entries into the registry.

            HKEY_CURREN_USER\Software\Microsoft\Office\Common\ userInfo

            Save the contents of a sample user into a .reg file and execute it in your bat file

            http://support.microsoft.com/kb/82821

            That may work.
            McCoy: "Medical men are trained in logic."
            Spock: "Trained? Judging from you, I would have guessed it was trial and error."

            Comment


              #7
              thanks both, I will try these ideas in the a.m.



              (\__/)
              (>'.'<)
              ("")("") Born to Drink. Forced to Work

              Comment


                #8
                Add those reg entries (if they're right) into the "Default User" profile on the machine. That way, they'll be used as the default settings for all users on the box.

                Comment


                  #9
                  cracked it - simple really

                  run create object on a virgin machine.
                  the object picks up the log on as the objects username but without applying it

                  so , capture it then apply it.


                  if its not a virgin machine, you are simply capturing the correct username and then applying it back


                  thanks for all the help dudes



                  dim objword
                  dim myUserName
                  dim myUserInitials
                  Set objWord = CreateObject("word.Application")
                  myUserName = objWord.UserName
                  myUserInitials = objWord.UserInitials
                  objWord.UserName = myUserName
                  objWord.UserInitials = myUserInitials
                  objWord.Quit
                  (\__/)
                  (>'.'<)
                  ("")("") Born to Drink. Forced to Work

                  Comment

                  Working...
                  X