Posted on 07-28-2011 07:39 AM
We opened a new office in India, and I modified our script to change the
timezone to theirs...when I casper remote it to a system it works, but
when it's in the build process it returns...
Result of running TimeZone_Pune_India.sh was: 2011-07-28 07:36:24.385
writeconfig[1932:903] *** error while attempting to remove old time zone
file: Error Domain=NSCocoaErrorDomain Code=512 UserInfo=0x100115cc0
""localtime" couldn't be removed." Set TimeZone: Asia/Kolkata
#!/bin/sh
Systemsetup="/usr/sbin/systemsetup"
$systemsetup -settimezone Asia/Kolkata
John Wojda
Lead System Engineer, DEI & Mobility
3333 Beverly Rd. B2-338B
Hoffman Estates, IL 60179
Phone: (847)286-7855
Page: (224)532.3447
Team Lead DEI: Matt Beiriger
<mailto:mbeirig at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.>
Team Lead Mobility: Chris
<mailto:cstaana at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.> Sta
Ana
Mac Tip/Tricks/Self Service & Support
<http://bit.ly/gMa7TB>
"Any time you choose to be inflexible in your approach to an
unpredictable project you are already building failure into your plan"
Posted on 07-28-2011 12:19 AM
If you are calling a command in a script you want to use back ticks...
systemsetup=/usr/sbin/systemsetup
Though I am not sure why you would do this in the first place and not
just call the full path in the command? Unless I am missing something
here?
-Tom
Posted on 07-28-2011 12:52 AM
Back ticks would set systemsetup (variable) to the result of executing /usr/sbin/systemsetup, unless I'm missing something. And I agree, why not just use the full path when setting the time zone.
When configured in the Build, does it run after first reboot? Startup item..
leslie
Posted on 07-28-2011 08:26 AM
Try using single quotes:
#!/bin/sh
systemsetup='/usr/sbin/systemsetup'
$systemsetup -settimezone Asia/Kolkata
Leslie N. Helou
Senior Systems Engineer
Bell Techlogix
8888 Keystone Crossing, Suite 1700
Indianapolis, IN 46240
317.704.6408
Posted on 07-28-2011 09:29 AM
If you're not opposed to using Casper's Managed Preferences (MCX) then I
On 7/28/11 9:39 AM, "Wojda, John" <John.Wojda at searshc.com> wrote:
suggest using that. It works great for me here, including our office in
India. Plus, it's one place to set rather than running a script on each
machine.
Domain: com.apple.MCX
Apply To: System Level Enforced
Key Name: timeZone
Type: String
Value: Asia/Kolkata
--
William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492
Posted on 07-28-2011 09:37 AM
We seem to have some kind of binding issue, the users can't login w/o the right timezone set it seems.
When I try to create the MCX it only goes to user level enforced or unmanaged... it doesn't give the option of system level...
Will try it and see how it works!
Thank you!
John Wojda
Lead System Engineer, DEI & Mobility
3333 Beverly Rd. B2-338B
Hoffman Estates, IL 60179
Phone: (847)286-7855
Page: (224)532.3447
Team Lead DEI: Matt Beiriger
Team Lead Mobility: Chris Sta Ana
Mac Tip/Tricks/Self Service & Support
"Any time you choose to be inflexible in your approach to an unpredictable project you are already building failure into your plan"
Posted on 07-28-2011 09:50 AM
When is the script trying to run? If you are trying to run the script whilst the machine is netbooted, then it will almost certainly fail as it will try and change the time in the netboot image and not the netinstall image. You need to run this after the machine has rebooted onto the deployed image.
Just a thought.
Sean
Posted on 07-28-2011 09:56 AM
Regarding the login issue, it could be due to the difference in time between the client and the authentication server. Kerberos (e.g. if you're using AD) requires a close synchronization of times. IIRC, the default clock skew is 5 minutes, which is a lot less than a timezone difference.
-Charlie
-------------------------------------
Charlie Smith
Desktop Engineer
Information Services Department (ISD)
MIT Lincoln Laboratory
244 Wood St. Lexington, MA 02420
Phone: 781.981.0854
-------------------------------------
Posted on 07-28-2011 11:37 AM
Binding doesn't care about time zone. Only the minutes off by the top of
the hour.
When creating your Managed Preference, select the Definition tab at the
top of the window and select Computer Level: Allowed. (I actually select
all to be Allowed so that I can change them later if I need.) This will
affect what you're able to select in the Apply To drop down menu.
If that doesn't make sense then let me know. I can send a screenshot.
--
William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492
Posted on 07-28-2011 02:48 PM
I used to call the below post imaging as part of my post imaging policy. Is based on a script from the resource kit.
# HARDCODED VALUES ARE SET HERE
timeServer=""
timeZone=" "
# CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 4 AND, IF SO, ASSIGN TO "timeServer"
if [ "$4" != "" ] && [ "$timeServer" == "" ];then
timeServer=$4
fi
if [ "$5" != "" ] && [ "$timeZone" == "" ]; then
timeZone=$5
fi
####################################################################################################
#
# SCRIPT CONTENTS - DO NOT MODIFY BELOW THIS LINE
#
####################################################################################################
OS=/usr/bin/defaults read /System/Library/CoreServices/SystemVersion ProductVersion | awk '{print substr($1,1,4)}'
if [ "$timeServer" != "" ]; then
if [[ "$OS" < "10.5" ]]; then
echo "Setting network time server to: $timeServer..."
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/systemsetup -setnetworktimeserver $timeServer
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/systemsetup -setusingnetworktime on
else
echo "Setting network time server to: $timeServer..."
/usr/sbin/systemsetup -setnetworktimeserver $timeServer
/usr/sbin/systemsetup -setusingnetworktime on
fi
else
echo "Error: The parameter 'timeServer' is blank. Please specify a time server."
fi
sleep 5
OS=/usr/bin/defaults read /System/Library/CoreServices/SystemVersion ProductVersion | awk '{print substr($1,1,4)}'
if [ "$timeZone" != "" ]; then
if [[ "$OS" < "10.5" ]]; then
echo "Setting time zone for OS $OS..."
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/systemsetup -settimezone "$timeZone"
echo "Refreshing the clock in the Menu Bar..."
/usr/bin/killall SystemUIServer
else
echo "Setting time zone for OS $OS..."
/usr/sbin/systemsetup -settimezone "$timeZone"
echo "Refreshing the clock in the Menu Bar..."
/usr/bin/killall SystemUIServer
fi
else
echo "Error: The parameter 'timeZone' is blank. Please specify a valid time zone."
fi
Posted on 07-28-2011 06:44 PM
It doesn't make sense, but I understand it anyway.