• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 683
  • Last Modified:

help with logon script setup and execution

Greetings,

I need to set a login script that runs locally on a 2008 R2 server running remote desktop services. It should import an Outlook 2007 PRF, then close outlook, then run the next command to install our doc management system add in for outlook 2007. I only need this to run once per user, at first login.

I wanted to run it locally, rather than in the domain login script, since it only needs to happen on the terminal server, not all domain computers.

I have the script and it does load the PRF. However, users are prompted to enter their username / initials, answer if they want online help, and then asked about updates, before being allowed to finish the outlook wizard. Even if this info is entered manually, which I want to avoid, it does not proceed with the next part of the script to add the doc mgt system add in. It doesn't close outlook automatically either.

I appreciate any help getting this to run. Script below, edited from what I got from FarrellFritz here:

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27261784.html

____________________________________________________________________________________________
IF EXIST C:\Users\%username%\AppData\Roaming\Microsoft\Outlook\ GOTO SKIP_PRF

"C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe" /importprf C:\OutlookTerm.PRF

PING localhost -n 30 > NUL

TASKKILL /IM OUTLOOK.EXE /f

REM PING localhost -n 10 > NUL

"C:\Program Files\Interwoven\WorkSite\addiman.exe" Filesite

:SKIP_PRF

:EXIT

_____________________________________________________________________________________________

and this one just to add PRF

"C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe" /importprf C:\OutlookTerm.PRF
0
king daddy
Asked:
king daddy
  • 5
  • 2
  • 2
2 Solutions
 
oBdACommented:
OK, I'll bite as far as the script part is concerned.
For the configuration of the Outlook profile to avoid the initial prompts, you should ask a dedicated question in the appropriate TAs, Outlook and Exchange:
http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/
http://www.experts-exchange.com/Microsoft/Applications/Outlook/
To your script: it doesn't proceed because it's waiting for Outlook to close.
You need to start Outlook using "start" so that Outlook will be started in the background, and the script can continue.
Then you should never use "C:\Users\%username%" in a script; this is not necessarily the user's profile folder. To access the user's profile root, use "%UserProfile%", and in this case, use "%AppData%" to access the user's AppData folder.
In the same way, you should use %ProgramFiles% instead of "C:\Program Files" (and/or "%ProgramFiles(x86)%"). Finally, a possible issue (according to the respective installation folders)) with your add-in is that your Outlook seems to be the 32bit version, while the plugin comes from a 64bit folder.
@echo off
if exist "%AppData%\Microsoft\Outlook" goto :eof
start "" "%ProgramFiles(x86)%\Microsoft Office\Office12\Outlook.exe" /importprf C:\OutlookTerm.PRF
ping.exe localhost -n 30 >NUL
taskkill.exe /im OUTLOOK.EXE /f
REM ping.exe localhost -n 10 >NUL
"%ProgramFiles%\Interwoven\WorkSite\addiman.exe" Filesite

Open in new window

0
 
nappy_dCommented:
You can you Active directory and permit only one computer or user to be able to read and apply your script.

Launch your group policy MMC
From the left-hand pane, click on your GPO(see pic)
In the right-hand pane, click on the delegation tab(see pic)
In the bottom right-hand area, click on advanced
Click on Authenticated users
In the permissions lists, locate the permission Apply Policy and uncheck it
Click on Add
Add the user group, user, computer group or computer to the permission list
Make sure the Apply and Read permission are given to the object(s)
Save your settings and test
Now make sure this GPO exists at an OU level that contains your computer and your user, by linking it.

  GPO MMC
0
 
king daddyAuthor Commented:
thanks for biting oBdA, I can really use the help. I will apply your edits to the script and test it out. I will also ask a new question regarding the wizard install of outlook 2007 and the subsequent prompts I would like to skip. I will post the link here so you can check it out, if you like.

thanks nappy_d. I will check out the GPO settings.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
king daddyAuthor Commented:
I just checked and the add-in is actually in the %ProgramFiles (x86)% folder. Also, the REM is a typo of sorts, I copied the incorrect file. Still, it's only the add-in path and REM that are different so your direction is still valid.

thanks again.
0
 
king daddyAuthor Commented:
here is a link to the other question regarding skipping user prompts. thx

http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_28130142.html
0
 
king daddyAuthor Commented:
so this worked for me, kinda. Still get the RSS pop-up but I can definitely live with that. Not sure why but when I put "%ProgramFiles%\Interwoven\WorkSite\addiman.exe" Filesite, it doesn't work. When I put what is below, it works.

thanks again for the help.

@echo off
if exist "%AppData%\Microsoft\Outlook" goto :eof
Reg Add HKCU\Software\Microsoft\Office\Common\UserInfo /v UserName /d "%username%"
Reg Add HKCU\Software\Microsoft\Office\Common\UserInfo /v UserInitials /d %username:~0,2%
Reg Add HKCU\Software\Microsoft\Office\12.0\Common\General /v ShownOptIn /t REG_DWORD /d 1 /f
start "" "%ProgramFiles(x86)%\Microsoft Office\Office12\Outlook.exe" /importprf C:\BRtermPRFv2.PRF
ping.exe localhost -n 60 >NUL
taskkill.exe /im OUTLOOK.EXE /f
ping.exe localhost -n 30 >NUL
"C:\Program Files (x86)\Interwoven\WorkSite\addiman.exe" Filesite
ping.exe localhost -n 15 >NUL
start "" "%ProgramFiles(x86)%\Microsoft Office\Office12\Outlook.exe"

Open in new window

0
 
oBdACommented:
Since it's a 32bit application after all, you'll need "%ProgramFiles(x86)%" to access the Interwoven program folder.
0
 
nappy_dCommented:
Thanks for the points but I thought my answer was worth more as it directly answered your question. Hope it all works for you ;)
0
 
king daddyAuthor Commented:
you are correct oBdA. It works now that I have edited it.

nappy_d - I am sorry you feel that way. While I do appreciate your help with this issue, you demonstrated how to set it in GPO to run per group, user, or machine. That addressed the one-sentence second paragraph. The major portion of my question had to do with the script itself not running past opening outlook and importing the PRF. So, while helpful in that I learned something, it was essentially useless until the script actually worked. The script now works, but I am running it locally. So your suggestion wasn't even put to use. The code I was given was most helpful in this situation, especially since I have very little experience with coding anything, hence the point distribution. I hope this doesn't prevent you from helping me in the future should I need it, and should you have relevant info.

Thanks to both of you.
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now