 |
10th November 2008, 14:46
|
#1
|
|
Super poster
Join Date: Jul 2005
Location: Castle Saburac
Posts: 3,838
|
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
__________________
I have decided on my career path. I will become a nun. Sister, please come clean if you wish to avoid a fisting - Jeremy Bender
|
|
|
10th November 2008, 15:01
|
#2
|
|
Lurker not a fighter
Join Date: Aug 2006
Posts: 72
|
The profile gets created by the system on logon anyway.
I might have the wrong end of the stick here? 
|
|
|
10th November 2008, 15:20
|
#3
|
|
Super poster
Join Date: Jun 2007
Location: Your local branch
Posts: 2,776
|
Quote:
Originally Posted by EternalOptimist
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.
|
|
|
10th November 2008, 16:43
|
#4
|
|
Super poster
Join Date: Jul 2005
Location: Castle Saburac
Posts: 3,838
|
Quote:
Originally Posted by NickFitz
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

__________________
I have decided on my career path. I will become a nun. Sister, please come clean if you wish to avoid a fisting - Jeremy Bender
|
|
|
10th November 2008, 16:55
|
#5
|
|
Super poster
Join Date: Jun 2007
Location: Your local branch
Posts: 2,776
|
Quote:
Originally Posted by EternalOptimist
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." 
|
|
|
10th November 2008, 20:50
|
#6
|
|
Contractor Among Contractors
Join Date: Jul 2005
Location: the centre of the world - according to Jack Straw
Posts: 1,692
|
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.
|
|
|
10th November 2008, 21:23
|
#7
|
|
Super poster
Join Date: Jul 2005
Location: Castle Saburac
Posts: 3,838
|
thanks both, I will try these ideas in the a.m.

__________________
I have decided on my career path. I will become a nun. Sister, please come clean if you wish to avoid a fisting - Jeremy Bender
|
|
|
11th November 2008, 10:10
|
#8
|
|
Lurker not a fighter
Join Date: Aug 2008
Location: Manchester
Posts: 76
|
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.
|
|
|
11th November 2008, 11:23
|
#9
|
|
Super poster
Join Date: Jul 2005
Location: Castle Saburac
Posts: 3,838
|
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
__________________
I have decided on my career path. I will become a nun. Sister, please come clean if you wish to avoid a fisting - Jeremy Bender
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 03:48.
|  |
| Advertisers |
|
| Contractor Alliance |
Formed a new Ltd Co?
20% off business insurance
£10 off Bauer & Cottrell contract reviews
Find co-workers & client introductions
Increase your value to clients here
|
|