I have been working on a powershell sync script that will be used to control what users have on their desktop (mainly lnk/shortcut files). I have it currently setup to do basic comparisons to add/remove/update the files that are stored locally. The main problem that I am running into is that I don't have a good way to differentiate between deployed links and user created links. Depending on how I sync the files, I run into problems.
Problem 1: If I force the client location to stay in sync with the server, everything on the desktop gets wiped out every time the script is run.
Problem 2: If I don't force a client side sync, when I change/remove a file, the client side retains the files.
So if that makes any sense, I'm hoping someone knows of a way to flag the files that I send down to the local computer. I could then build my script to look for that flag and only affect deployed files.
I wonder if using
Get-Acl
andSet-Acl
on the Group property of the files would be a valid way to flag the files for your needs.If all your machines are using NTFS formatted drives then you could use an alternate data stream to store a message that marks the links that your script added.
Custom class method (PowerShell v2):
http://poshcode.org/1430
COM method:
http://groups.google.de/group/microsoft.public.windows.powershell/msg/66697a0aba7ab9ec
Another option is to write a message into some unused metadata item. Here is an example using the TagLib library in PowerShell:
http://huddledmasses.org/editing-media-tags-from-powershell/
Here is another example using COM, but the code does a lot of stuff that could be done by standard PowerShell commands:
http://www.vistax64.com/powershell/70760-accessing-metadata.html
Focus on the use of these lines: