Script to Copy preference file to all users profiles and to the default template
I have build a package using Apple PackageMaker, this will install an application and a preference (plist) file to the current logged in user. Now I wanted to build a postflight script, which can copy a plist (ex com.test.plist) form an current logged in user to other user account on a machine also to the default user template (/System/Library/user template/...../Library/preferences) so any new user account created will have same preference file copied.
Hi Mark...here is another script which work well if I have to copy my preference file from an account named as "admin" or some other account. However, it not certain that all Mac machine will have a account named as "admin". This is why I am looking for a way to copy the preference file from /private/var location to all user accounts on a mac.
#!/bin/sh
localUsers=$( dscl . list /Users UniqueID | awk '$2 >= 501 {print $1}' | grep -v admin )
for userName in "$localUsers"; do
cp /Users/admin/Library/Preferences/org.mypreference.plist /Users/$userName/Library/Preferences/
chown $userName /Users/$userName/Library/Preferences/org.mypreference.plist
done
I tried to update it as suggest in some other forum like this, still no luck
#!/bin/sh
UserAccounts=`dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }'`
for userName in "$UserAccounts"; do
cp /private/var/org.mypreference.plist /Users/$userName/Library/Preferences/
chown $userName /Users/$userName/Library/Preferences/org.mypreference.plist
done
When I run the above script it comes up with the following error:
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
chown: admin: No such file or directory
chown: admin/Library/Preferences/org.mypreference.plist: No such file or directory
Similar Messages
-
Copy a file to all users' desktops.
I want to copy a PDF file to all users' desktops, so I created a GPP to do this and it works if I place the source file, the PDF, on a shared folder.
However, my GPP will span a large network, across half the globe, thus having the PDF on a file server in one location will take a long time to copy to users' workstations in another location. I thus would like to replicate the PDF file along all the DCs
using the NETLOGON folder.
I thus placed the file in the following folder on my local domain controller:
C:\Windows\SYSVOL\sysvol\brightstarcorp.com\scripts\APAC\Files for APAC users
In my GPP, I used the following reference for the location of the PDF file:
Source: %logonserver%\NetLogon\APAC\Files for APAC users\APAC IT Support Contact Details final.pdf
Target: %userprofile%\desktop\APAC IT Support Contact Details final.pdf
Is this the correct way to do this?
My GPP is created on a Win2012 server for Win2008 domain controllers and Win7 clients.When I put this in Explorer on the test machine:
%logonserver%\NetLogon\APAC\Files for APAC users\APAC IT Support Contact Details final.pdf
I get the error:
"Windows cannot access \\MyADServer01\NetLogon\APAC\Files for APAC users\APAC IT Support Contact Details final.pdf"
But when I put this into Explorer"
%logonserver%\NetLogon\APAC\Files for APAC users\
....it opens the folder (replacing the %LOGONSERVER% with the domain controller name "MyADServer01" and displays the file. I can then double-click the file and open it.
Using the DC name or not, with the filename in the Explorer address bar, it will not open the file.
Event Viewer:
Log Name: Application
Source: Group Policy Files
Date: 27/12/2014 7:39:38 PM
Event ID: 4098
Task Category: (2)
Level: Warning
Keywords: Classic
User: SYSTEM
Computer: TestWS.mydomain.com
Description:
The user 'APAC IT Support Contact Details final.pdf' preference item in the 'APAC - Add IP Support Document to Workstation {E31F55EA-EF46-400B-A77A-012ECF400EC7}' Group Policy object did not apply because it failed with error code '0x80070002 The system cannot
find the file specified.' This error was suppressed.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Group Policy Files" />
<EventID Qualifiers="34305">4098</EventID>
<Level>3</Level>
<Task>2</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-12-27T08:39:38.000000000Z" />
<EventRecordID>258023</EventRecordID>
<Channel>Application</Channel>
<Computer>TestWS.mydomain.com</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData>
<Data>user</Data>
<Data>APAC IT Support Contact Details final.pdf</Data>
<Data>APAC - Add IP Support Document to Workstation {E31F55EA-EF46-400B-A77A-012ECF400EC7}</Data>
<Data>0x80070002 The system cannot find the file specified.</Data>
</EventData>
</Event>
Strange! -
Palm Treo 700p How do I delete the User Profile and retain the data?
I want to sync my palm to my computer under a new profile. I don't want to loose the data. How do I delete or change the 700p profile so when I sync it thinks it is a different 700p?
Thanks in advance
JT
Post relates to: Treo 700p (Verizon)In Palm Desktop, click the drop-down list of Hotsync IDs and select Edit Users. Never done it myself, but if all you want to do is change your Hotsync ID's name, that should do it.
smkranz
I am a volunteer, and not an HP employee.
Palm OS ∙ webOS ∙ Android -
Resource assignment WMS- Defining user profiles and equipment profile
Can anyone please let me know how I can define the user profiles and equipment profiles in SAP WMS We have a decentralized WMS that we are implementiing . Can any one please let me know how I can define the user profiles and aalso the equipemtn profiles. Ability to skip tasks and task groups.
ThanksYes - this was the first set of information the OP dumped from his system. About line 5 of the post.
But I do wonder whether the 9.2.0.6 (not latest patch) makes a difference? Or perhaps the connect time is being used as part of a composite limit. -
How to deploy a file on all users C drive via group policy
I'm trying to deploy a file on all users C drive via group policy but its not working. logon script is already kept in place but nothing is happening. If I run the same command from my pc it's working fine. Does any one have good script to copy & deploy
the file. Pls helpHi,
You can use Group Policy Preferences to deploy this and Item-level-Targetting to filter by OUs/groups, wmi filters ,etc.
Computer Configuration / User Configuration - Preferences - Windows Settings - Files
More on this here.
http://technet.microsoft.com/en-us/library/cc772536.aspx
Hope this helps.
Regards,
Calin -
How do I move all my files from one User Profile (account) into another?
I needed to create a new account and want all of my files accessible in the new one.ok, what you're learning right now is 101 unix, which is good. Unix is a good thing
now: the way unix works, and macos (which uses unix underneath) the files and folders work like a hierarchy.
the start of that tree is /
so, if you were to do:
cd /
(cd means change directory)
it will bring you at the highest branch of the file system.
cd /Users
will bring you to where all the users are.
to see whats in /Users you can use your friend ls command
ls means list files/directories
so:
cd /Users
ls -la
(the -la here means show all (even hidden) and long format (very verbose)) this flag is very optional.
you will see
fred
user2
for example.
if you want to see the desktop of user2 you would change directory to it then list the files.
for example:
cd /Users/user2/Desktop
Note that the files and directory are case sensitive, so, desktop is NOT the same as Desktop, or DESKTOP
ls -la
you should then be able to see everything in users2 desktop
you could have done as well the same thing in smaller steps, for example:
cd /
cd Users
cd user2
cd Desktop
this is the equivalent of cd /Users/user2/Desktop
So, for your file, i don't know where it was, but know that if you log in as user2, it will directly put you in
/Users/user2
which most likely the file you had created from the other user was in /Users/user1
if you copied all the files from /Users/original_user to /Users/secondUser
most likely yes, all your mail, bookmarks etc would be copied over.
so in your case.
sudo chown -R seconduser:staff /Users/secondUser
should work
Remember that if you start a path with the character / it means start from the root of the file system, at the highest top you can ever get.
so
cd /Users/fred
is not the same as
cd Users/fred
unless you were in / already
i know it may be confusing at first but it's actually very logical if you play with it.
to simplify, think of it that / means C:\ on windows
you can't go any higher than C:\ (in a way)
if you're unsure which directory you're currently in, you can always type:
pwd
it will tell you where you are.
for example:
cd /
pwd
this shows /
cd Users
pwd
this now shows /Users
cd /System/Library
pwd will show /System/Library
cd /
cd /Users
cd fred
cd Library
pwd will show /Users/fred/Library
unix can look very scary but it's actually vital and very necessary to do tasks sometimes that would take for ever to do via the windows. This is good learning.
so for the myfile you had created, i can't tell you where it is, at the time you created, if you can do a pwd command you'll know the path,
ls -la (this shows all the files where you are)
if you see myfile in the list
do a pwd
whatever is return, the real location of the file would be:
whatever pwd returned / myfile
I hope that makes sense. -
How can I copy a file with all attributes
Is there a way within Java to copy a file, with all its file attributes?
I have seen a number of custom methods posted on these forums for copying the contents of a file to a new file with the same name in another location. The problem is that these methods don't copy the file attributes, particularly the creation date.
If there is no way to do this in Java, is there a way to have Java execute an operating system command, such as "COPY" or to access the O/S to change the file attributes?
Thanks for any help you can provide.This is how runtime executes a batch file.
try {
Process p = Runtime.getRuntime().exec("cmd /c start c:\\batfile.bat");
p.waitFor();
} catch (Exception e) {
System.out.println(e.toString());
} -
Move the Cache files for all user in the domain, which work with the PC
Is there a possibility to chance the Cache file for all User.
If i logon with a new user the Cache is written automatically in Proflie of the user.
can configure to Java in such a way that with announce a user the Cache file get automatically moved to c:\temp.
Thanks for your helpoh, too bad, it is part of the requirement-we need to do it automatically through web.
Any easier method to change the client machine deployment.properties through web?
Need to deploy the application to thousands PC and the PC configuration may be different one by one.
oldguy -
Global emacs config file for all users?
Hi all,
i put .emacs in my home dir, but it do not take effect when 'sudo emacs'
so where should i put the config file for all users ?
thanks!use this elisp snippet to edit file by sudo
(defun xwl-revert-buffer-with-sudo ()
"Revert buffer using tramp sudo.
This will also reserve changes already made by a non-root user."
(interactive)
(let ((f (buffer-file-name))
(p (point)))
(when f
(let ((content (when (buffer-modified-p)
(widen)
(buffer-string))))
(kill-buffer (current-buffer))
(if (file-remote-p f)
(find-file
(replace-regexp-in-string "^\\/[^:]+:" "/sudo:" f))
(find-file (concat "/sudo::" f)))
(when content
(let ((buffer-read-only nil))
(erase-buffer)
(insert content)))
(goto-char p))))) -
I found this, sctipt, that I try to re-write.
As it is, it creates sub folders in the targetfolder, which I found out how to stop it from, by deleting the "\" backslash sign in line 9.
But what I also want is that subfolders if such should exist, also gets copied from $source to $target folder, as of now this doesn't happen. Reason why I chose to try to re-write the script is basically, I can read what it does and I like all the flashy
Things like counting and that it shows the percentage of the processbar AND the processbar :).
I just don't now how to re-write it proberly. By the way nothing should be re-named in the targetfolder every thing from sourcefolder should be "as is" in the sourcefolder.
$SourceFolder = "C:\Color1\TRID"
$targetFolder = “C:\Color2\TRID”
$numFiles = (Get-ChildItem -Path $SourceFolder -Filter *.*).Count
$i=0
clear-host;
Write-Host ‘This script will copy ‘ $numFiles ‘ files from ‘ $SourceFolder ‘ to ‘ $targetFolder
Read-host -prompt ‘Press enter to start copying the files’
Get-ChildItem -Path $SourceFolder -Filter *.* | %{
[System.IO.FileInfo]$destination = (Join-Path -Path $targetFolder -ChildPath $_.Name.replace(“_”,“\”))
if(!(Test-Path -Path $destination.Directory ))
New-item -Path $destination.Directory.FullName -ItemType Directory
[int]$percent = $i / $numFiles * 100
copy-item -Path $_.FullName -Destination $Destination.FullName
write-Progress -Activity “Copying … ($percent %)” -status $_ -PercentComplete $percent -verbose
$i++
Write-Host ‘Total number of files read from directory ‘$SourceFolder ‘ is ‘ $numFiles
Write-Host ‘Total number of files that was copied to ‘$targetFolder ‘ is ‘ $i
Read-host -prompt “Press enter to complete…”
clear-host;@Jaap
Yes I want to overwrite existing files, since backup is taken care of by another script.
Now I encounter this error when trying to use your write-progress example:
Get-ChildItem : A parameter cannot be found that matches parameter name 'Files'.
At line:3 char:51
+ $Files = Get-ChildItem -LiteralPath $SourceFolder -Files
+
~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
cmdlet ForEach-Object at command pipeline position 1
Supply values for the following parameters:
Process[0]:
Here is the script as I thought it should look like:
$SourceFolder = "C:\Color1\TRID"
$targetFolder = “C:\Color2”
$Files = Get-ChildItem -LiteralPath $SourceFolder -Files
$NumberofFiles = $Files.Count
$Files | ForEach-Object -Begin {
$FilesCopied = 0
-progress{
Write-Progress -Activity "Copying Files..." -PercentComplete [int](($FilesCopied/$NumberofFiles)*100) -CurrentOperation "$FilesCopied files copied out of total of $NumberofFiles files" -Status "Please wait."
"$((Get-ChildItem -Recurse -File -LiteralPath $SourceFolder).Count) files will be copied to $targetfolder"
Read-Host -Prompt 'Press Enter to Start Copying...'
Copy-Item $SourceFolder -Recurse -Destination $targetFolder -Force -verbose
$FilesCopied++
# What is wrong now? -
‘File in Use’ message is received when one user is in the report and another user tried to open the excel template. how to make excel template shared for multiple users so the users don’t see the ‘File in Use’ message?
Hi Febin,
In addition to others’ replies, we can create a shared workbook and place it on a network location where several people can
edit the contents simultaneously. For example, if the people in your work group each handle several projects and need to know the status of each other's projects, the group can use a shared workbook to track the status of the projects. All persons involved
can then enter the information for their projects in the same workbook.
Regarding how to do this,
the following article can be referred to reference.
Use a shared workbook to collaborate
http://office.microsoft.com/en-in/excel-help/use-a-shared-workbook-to-collaborate-HP010096833.aspx
Best regards,
Frank Shen -
Win7 and Reader X - default settings for ALL users/profiles
I have a custom browser/app that opens PDF's within the app which can sometimes cause issues. I found that if I set Reader X to not open in the browser (Edit>Preferences>Internet - uncheck "Display PDF in Browser") that this does resolve most issues. My problem...when changed this only affects the current user/profile that's logged in. Potentially there can be dozens of users on these laptops. The other setting is when opening a PDF, I get the warning about Protected Mode not being able to be used due to the current configuration. I can select "Always open with Protected Mode disabled" and I no longer get the message; but again, current user/profile only.
Is there a way to set these settings for ALL users/profiles? Running Win7 (32bit) with Reader X.I do not know why you experience this; what exactly happens when a non-admin users attempts to highlight something?
You are talking about highlighting in the same document? -
In PC I have changed the default app location from (c:/users/username/My Music/iTunes) to other (d:iTunes) and copied the previous content to new location and changed the Default location in Edit preference. Now in iTunes, my previous apps are not visible. Is there any solution to this?
wjosten - thanks very much for the detailed instructions. I'll try this as soon as I get my replacement and it looks like you'll probably end up getting the green tick
-
After a hard reset all user profiles are now accessible by every user
I initially had our office time capsule set up with 3 seperate user accounts ("profiles") via these instructions. Thus each user had a login for the time capsule that would then show them a shared folder that all users could see, and then a personal folder that only those logged into that account could see and access.
While I was out of the office a co-worker was having trouble connecting his new iMac to the time capsule, so he called apple for assistance and they had him do a hard reset. The hard reset saved all the profiles and all information in each folder, but now everyone can access every folder. I'm not completely sure of what steps they took to set it up after the hard reset, but now, no matter which account you are logged in as you see:
-"Shared"
-(Shared folder)
-"Users"
-(user 1)
-(user 2)
-(user 3)
So you have complete access to each users folders. Does anyone know if there is any easier way to set the user profiles back up the way they were originally set up by myself, or do I basically have to re-do the whole process (which includes saving and transfering all folders--which is a long process)?The security of the TC is designed for home networking.. because anyone who has physical access to the TC can easily access anything.. it is simply convenient perhaps to have user profiles.. but a quick 1 sec soft reset and anybody can gain access to anything.
see answer I wrote here.
https://discussions.apple.com/thread/4231228?tstart=0 -
User Profile Service Failed The Logon: (Almost all domain accounts cannot login)
We have a recently imaged a group of workstations with Windows 7 using SCCM 07.
Myself and other administrators can log in to the machines but regular accounts cannot.
We elevated a normal account to administrator and it was not able to log in.
Here are the errors from the event log
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Microsoft-Windows-User Profiles Service" Guid="{89B1E9F0-5AFF-44A6-9B44-0A07A7CE5845}" />
<EventID>1500</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2011-01-25T19:22:08.724507600Z" />
<EventRecordID>1425</EventRecordID>
<Correlation />
<Execution ProcessID="952" ThreadID="2792" />
<Channel>Application</Channel>
<Computer>xxxx</Computer>
<Security UserID="S-1-5-21-3380481182-2311050411-4097259448-9173" />
</System>
- <EventData>
<Data Name="Error">The system cannot find the file specified.</Data>
</EventData>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Microsoft-Windows-User Profiles Service" Guid="{89B1E9F0-5AFF-44A6-9B44-0A07A7CE5845}" />
<EventID>1520</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2011-01-25T19:22:08.724507600Z" />
<EventRecordID>1424</EventRecordID>
<Correlation />
<Execution ProcessID="952" ThreadID="2792" />
<Channel>Application</Channel>
<Computer>xxx</Computer>
<Security UserID="S-1-5-21-3380481182-2311050411-4097259448-9173" />
</System>
- <EventData>
<Data Name="Error">The system cannot find the file specified.</Data>
</EventData>
</Event>Hi,
I would like to suggest you to delete the error SID and create a new profile, and check the result, follow these steps:
Note: Back up the registry before you modify it.
1.
Delete the profile by using the Computer Properties dialog box. To do this, follow these steps:
a)
Click Start, right-click Computer, and then click Properties.
b)
Click Change settings.
c)
In the System Properties dialog box, click the Advanced tab.
d)
Under User Profiles, click Settings.
e)
In the User Profiles dialog box, select the profile that you want to delete, click Delete, and then click OK.
2.
Click Start, type regedit in the Start search box, and then press ENTER.
3.
Locate and then expand the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
4.
Right-click the SID that you want to remove, and then click Delete.
5.
Log on to the computer and create a new profile.
What is the result?
Alex Zhao
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Maybe you are looking for
-
Conditional formula in report painter.
Hello. I create new CO-PA report in KE31 transaction which is based on a form. In transaction KE35 I define the new form and in this form I want to create formula. This formula should be conditional. How to define conditional formula in that kind of
-
Inserting the default value for non existing date
hello, i am designing a matrix report for payslip for month wise in oracle 6i report builder. in that i want to display per day working hours of the month. i m using following query for achieving my goal : select a.paycode,b.empname,c.departmentname,
-
Can anyone offer some suggestions what the error message below means? CS6 Illustrator is crashing, often and almost always during the saving of a document. Computer Specs - OS 10.6.8, 2 x 2.66 Dual Core Intel Xeon, 4GB 667MHz DDR2 FB-DIMM Error Mess
-
Lightroom 5 mobile version still in testversion
Hello, i used to have the test version of lightroom 5 and lightroom mobile. After the test version of 30 days i bought the full version on amazon. The problem is now, that the mobile version is still in test version. and i can't use it anymore becaus
-
i have icloud for PC 2.1.3 and can not dawnload my pics !!!!!