siuko Posted July 6, 2010 Posted July 6, 2010 I am wanting to copy an excel file to each user in a certain OU. I tried using a logon batch file for the specific user OU that would do an IF NOT EXIST then copy the file to their H drives. It didnt work and I have a feeling that its either the H drive is mapped after this logon bat file has run, or when I changed the bat file it cannot read the %username% variable as the correct person. Anyone got any ideas?
srochford Posted July 6, 2010 Posted July 6, 2010 get it to write some logging info: echo starting >%temp%\excelcopy.log time /t >> %temp%\excelcopy.log if exist h:\ echo H drive OK >> %temp%\excelcopy.log if exist h:\project.xls goto copied echo about to copy file >> %temp%\excelcopy.log copy \\server\share\project.xls h:\ echo copied file >> %temp%\excelcopy.log :copied echo finishing off time /t %temp%\excelcopy.log - this should create a log file in the user's temp folder (so check it before they log off otherwise the log will be deleted!) and might help you to see what's going on.
Guest TheLibrarian Posted July 6, 2010 Posted July 6, 2010 for /f %%i in ( 'dsquery user -samid %username% ^| dsget user -hmdir ^| findstr /i /c:"[url="file://\\"'"]\\"'[/url]) do ( if not exist %%i\filename.ext copy [url="file://\\servername\sharename\filename.ext"]\\servername\sharename\filename.ext[/url] %%i ) No error checking or logs that srochford put in, this however doesn't use the H: drive letter. Maybe you can mash the two together.
siuko Posted July 6, 2010 Author Posted July 6, 2010 The error checking doesnt seem to be working at all and doesnt create the log. What user does the logon script run as? The user logging on or system?
Guest TheLibrarian Posted July 6, 2010 Posted July 6, 2010 A logon script is run as the interactive user.
Guest TheLibrarian Posted July 6, 2010 Posted July 6, 2010 At this point I'd go back to basics to work out what's happening. Just put in a login script that creates a file in the users home directory, see if that is working first. As this is group policy, I'd also check the policy link is enabled and that the user settings aren't disabled. You could add the setting that runs the logon script visibly so that you can watch what is happening.
siuko Posted July 6, 2010 Author Posted July 6, 2010 Hmmm I'm obviously doing something very silly then!! Just trying to implement the InContainer Kix UDF to see if that makes things easier. As you also say... will try some basic stuff
siuko Posted July 6, 2010 Author Posted July 6, 2010 Sorted now... Used the Incontainer and TranslateName Kix UDF to check the OU and then added a line to copy the file if in correct OU... AFTER the homeshare was mapped Thanks everyone for your help
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now