Hello All,
We were using following script to rename the computer name and it was working before 2 months.
#!/bin/bash
# jamf Api
apiUser="####"
apiPass="####"
jssURL="our_jamf_instance_url"
serial=$(system_profiler SPHardwareDataType | awk '/Serial\\ Number\\ \\(system\\)/ {print $NF}')
serialc=$(system_profiler SPHardwareDataType | awk '/Serial\\ Number\\ \\(system\\)/ {print substr($0,length-5)}')
base=$(curl -H "Accept: text/xml" -sfku "${apiUser}:${apiPass}" "${jpsURL}/JSSResource/computers/serialnumber/${serial}/subset/Location" | xmllint --xpath "/computer/location/building/text()" -)
echo Building:$base
scutil --set ComputerName $base-$serialc-M
scutil --set HostName $base-$serialc-M
scutil --set LocalHostName $base-$serialc-M
cname=$(scutil --get ComputerName)
echo ComputerName:$cname
exit 0
Now the script is returning error
cript result: -:1: parser error : Document is empty
^
Building:
scutil: invalid option -- 8
usage: scutil
interactive access to the dynamic store.
or: scutil --prefs [preference-file]
interactive access to the [raw] stored preferences.
or: scutil [-W] -r nodename
or: scutil [-W] -r address
or: scutil [-W] -r local-address remote-address
check reachability of node, address, or address pair (-W to "watch").
or: scutil -w dynamic-store-key [ -t timeout ]
-w wait for presense of dynamic store key
-t time to wait for key
or: scutil --get pref
or: scutil --set pref [newval]
or: scutil --get filename path key
pref display (or set) the specified preference. Valid preferences
include:
ComputerName, LocalHostName, HostName
newval New preference value to be set. If not specified,
the new value will be read from standard input.
or: scutil --dns
show DNS configuration.
or: scutil --proxy
show "proxy" configuration.
or: scutil --nwi
show network information
or: scutil --nc
show VPN network configuration information. Use --nc help for full command list
or: scutil --allow-new-interfaces [off|on]
manage new interface creation with screen locked.
or: scutil --error err#
display a descriptive message for the given error code
scutil: invalid option -- 8
usage: scutil
interactive access to the dynamic store.
or: scutil --prefs [preference-file]
interactive access to the [raw] stored preferences.
or: scutil [-W] -r nodename
or: scutil [-W] -r address
or: scutil [-W] -r local-address remote-address
check reachability of node, address, or address pair (-W to "watch").
or: scutil -w dynamic-store-key [ -t timeout ]
-w wait for presense of dynamic store key
-t time to wait for key
or: scutil --get pref
or: scutil --set pref [newval]
or: scutil --get filename path key
pref display (or set) the specified preference. Valid preferences
include:
ComputerName, LocalHostName, HostName
newval New preference value to be set. If not specified,
the new value will be read from standard input.
or: scutil --dns
show DNS configuration.
or: scutil --proxy
show "proxy" configuration.
or: scutil --nwi
show network information
or: scutil --nc
show VPN network configuration information. Use --nc help for full command list
or: scutil --allow-new-interfaces [off|on]
manage new interface creation with screen locked.
or: scutil --error err#
display a descriptive message for the given error code
scutil: invalid option -- 8
usage: scutil
interactive access to the dynamic store.
or: scutil --prefs [preference-file]
interactive access to the [raw] stored preferences.
or: scutil [-W] -r nodename
or: scutil [-W] -r address
or: scutil [-W] -r local-address remote-address
check reachability of node, address, or address pair (-W to "watch").
or: scutil -w dynamic-store-key [ -t timeout ]
-w wait for presense of dynamic store key
-t time to wait for key
or: scutil --get pref
or: scutil --set pref [newval]
or: scutil --get filename path key
pref display (or set) the specified preference. Valid preferences
include:
ComputerName, LocalHostName, HostName
newval New preference value to be set. If not specified,
the new value will be read from standard input.
or: scutil --dns
show DNS configuration.
or: scutil --proxy
show "proxy" configuration.
or: scutil --nwi
show network information
or: scutil --nc
show VPN network configuration information. Use --nc help for full command list
or: scutil --allow-new-interfaces [off|on]
manage new interface creation with screen locked.
or: scutil --error err#
display a descriptive message for the given error code
ComputerName:mymac
Do you have any idea how to fix this?Please suggest.