germano
asked on
Identify Shutdown in the GPO Logoff script
Hello everyone!
I want to run a script in the shutdown of the computer to copy some files from the user's My Documents that was logged in. So, I set the script in the GPO Computer Configuration Shutdown Script. The problem is that this script runs with machine account, so I can not identify which user is shutting down the computer (%username% is blank). Realizing this, I removed the script from Computer Configuration Shutdown and I put it on User Configuration Logoff Script. Now the problem is that the script is executed whenever the user logs off, restarts or shuts down the computer, and what I want is that the script run (copy the files from User's My Documents) only when the user turns off its computer. So how can I achieve this?
Thanks!
I want to run a script in the shutdown of the computer to copy some files from the user's My Documents that was logged in. So, I set the script in the GPO Computer Configuration Shutdown Script. The problem is that this script runs with machine account, so I can not identify which user is shutting down the computer (%username% is blank). Realizing this, I removed the script from Computer Configuration Shutdown and I put it on User Configuration Logoff Script. Now the problem is that the script is executed whenever the user logs off, restarts or shuts down the computer, and what I want is that the script run (copy the files from User's My Documents) only when the user turns off its computer. So how can I achieve this?
Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ploftin,
The script didn't work, because, i think at shutdown script the computer "do not know" which user was loged in. Thus, the strLoggedOnUserName variable returned empty.
Kent,
I think folder redirection is a good option, however, all files will synchronize at user logs off, restarts or shuts down the computer, ie, just like the logoff script I mentioned.
Any clues?
The script didn't work, because, i think at shutdown script the computer "do not know" which user was loged in. Thus, the strLoggedOnUserName variable returned empty.
Kent,
I think folder redirection is a good option, however, all files will synchronize at user logs off, restarts or shuts down the computer, ie, just like the logoff script I mentioned.
Any clues?
ASKER
Experts,
I think the logoff script may be the way. Instead of trying to identify the user at shutdown, I just need to identify whether the logoff was triggered by a command of a shutdown, restart, or just a logoff.
What do you think? And how do I acomplish this?
Germano
I think the logoff script may be the way. Instead of trying to identify the user at shutdown, I just need to identify whether the logoff was triggered by a command of a shutdown, restart, or just a logoff.
What do you think? And how do I acomplish this?
Germano
If you ONLY want to copy the files at Shutdown, then using the Shutdown Script is your best bet. What you need to do is be able to identify the last logged in user. That can be accomplished by writing the last logged in user to the PC description field at login. You can therefore read that information during shutdown to determine which user profile to grab the files from.
Let me know if you need assistance with setting things up to modify the description.
Let me know if you need assistance with setting things up to modify the description.
ASKER
Ok, markdmac,
But the shutdown script credentials will have permition to get de local user files and put them in to the network folder?
Germano.
But the shutdown script credentials will have permition to get de local user files and put them in to the network folder?
Germano.
As long as domain admins and system have rights to the file then yes.
ASKER
I would have to give full access to the SYSTEM user to all local folders of all computers and network backup folder. Does not work for me.
Why not? Use XCACLs to set it and forget it.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
pwindell,
I talked about My Documents folder only in my question because it was the only folder that I could not certainly define by the variable %userprofile%. But I'm also interested in doing copy other directories too, such as Desktop, Favorites, Outlook address book and some others users folders. Can I sync them too?
I talked about My Documents folder only in my question because it was the only folder that I could not certainly define by the variable %userprofile%. But I'm also interested in doing copy other directories too, such as Desktop, Favorites, Outlook address book and some others users folders. Can I sync them too?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, markdmac,
Lets say I have 100 users in my domain, but I want to move the entire profile of only 20 users. Can I do this?
Lets say I have 100 users in my domain, but I want to move the entire profile of only 20 users. Can I do this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The suggestion I made about using Folder Redirection combined with Offline Files would complete the goal exactly as you asked. IT specifically works with My Documents, Desktop, and several otehr folders.
ASKER
I did found a answer by myself. The others are only good tips to the future.
ASKER
I was very busy, but I will try the solutions and put the results.
Thanks!