Jump to content

Logoff Script


MattX
 Share

Recommended Posts

Right, stick with me on this as its gonna take a little explaining.

Where I work we don't use roaming profiles so the children and staff at the school get a little cross when their bookmarks in IE don't follow them around. So I ended up knocking up this script which works fine when they logon:

; AutoIt Version:    3
; Language:          English
; Platform:          WinXP
; Author:            Matt Marsh - mmarsh@#########
; Script Function:  Bookmark Programe - Logon Script

if FileExists ( EnvGet("USERPROFILE") & '\Favorites\st johns homepage.url' ) then
    Filecopy ( 'N:\bookmarks\Favorites\*.*', EnvGet("USERPROFILE") &'\Favorites')
Else 
    Filecopy ( '\\stjohns01\apps\Favorites\st johns homepage.url', EnvGet("USERPROFILE") &'\Favorites')
        Filecopy ( 'N:\bookmarks\Favorites\*.*', EnvGet("USERPROFILE") &'\Favorites')
endif

exit

All its doing is checking for a URL on the PC and then copying over any other URLs that are held on the users N: drive [ home dir ] - which is hidden just for info.

All that works fine.

Of course if they add some bookmarks when they are surfin' then i want to add those into their N: drive so next time they logon to a different PC they are copied over to their profile for when they logon. So I knocked up this:

; AutoIt Version:    3
; Language:          English
; Platform:          WinXP
; Author:            Matt Marsh - mmarsh@#########
; Script Function:  Bookmark Programe Logoff Script

Filecopy ( EnvGet("USERPROFILE") &'\Favorites\*.*', 'N:\bookmarks\Favorites' )

This also works, but does it work as a logoff script ? Errrrrr no. Now my questions are. Can a logoff script be an .EXE or does it have to be in the .CMD or .BAT format.

I am using the logoff script within AD and a policy on a 2003 server. I have forced a policy update and when checking a PC thats logging off it is running any logoff scripts that are setup.

Now I tried using .CMD instead by using an Xcopy command:

xcopy %userprofile%\favorites\*.* n:\bookmarks\favorites /s /y

But this returns a 'invalid number of parameters' error.

Can someone tell me where the hell I am going wrong ?

Link to comment
Share on other sites

well you can run an exe from a bat file. :)

Dos doesn't like long filenames, or long directories, unless in quotes. I think you might need the shortnames. I would just run my compiled exe from the Bat file.

looks good, unless you are logged out of the network before it runs.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

well you can run an exe from a bat file. :)

Dos doesn't like long filenames, or long directories, unless in quotes. I think you might need the shortnames.  I would just run my compiled exe from the Bat file.

looks good, unless you are logged out of the network before it runs.

<{POST_SNAPBACK}>

Indeed that may be part of the problem - the network killing the network drive access before it gets a chance to run. I am not sure of the process when it comes to log off scripts - looking on the MS site as usual tells you nothing.

I've spashed out on MS Windows 2003 inside out - £28 from amazon - that may tell me + I wanted it for a few other things.

If I cannot get the log off script to work I'll either set it up as a normal app for the user to fire off just before they log off - [ some hope I know ] - or I'll have to think of another way of doing it.

I wonder if one could write a script that runs in the back ground and detects when IE closes and when it does copy the files then....

Anyone written such a thing, maybe sort of detect when IEXPLORE has terminated. . .

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...