<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://www.stijn.it/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.stijn.it/" rel="alternate" type="text/html" /><updated>2019-12-19T22:08:44+00:00</updated><id>https://www.stijn.it/feed.xml</id><title type="html">stijn.it</title><subtitle>Blog about Mac it stuff</subtitle><author><name>Stijn Brattinga</name></author><entry><title type="html">Automatically rename Macs using Addigy maintenance scripts</title><link href="https://www.stijn.it/Automatically-Rename-Macs-Using-Addigy-Maintenance-Scripts/" rel="alternate" type="text/html" title="Automatically rename Macs using Addigy maintenance scripts" /><published>2019-12-15T00:00:00+00:00</published><updated>2019-12-15T00:00:00+00:00</updated><id>https://www.stijn.it/Automatically-Rename-Macs-Using-Addigy-Maintenance-Scripts</id><content type="html" xml:base="https://www.stijn.it/Automatically-Rename-Macs-Using-Addigy-Maintenance-Scripts/">&lt;p&gt;When onboarding new clients in Addigy I like to add a few maintenance scripts. One of these scripts automatically renames a Mac according to the logged in user, type of Mac (MacBook Pro, Mac mini etc), company name and last digits of serial number. This results in something like this&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;John-FruitCo-MBP-3fsgd&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Addigy allows you to run these scripts based on values in a &lt;a href=&quot;https://support.addigy.com/support/solutions/articles/8000075303-best-practices-and-examples-for-custom-facts&quot;&gt;Custom Fact&lt;/a&gt;, or on a specified time. In this case I usually go for the latter.&lt;/p&gt;

&lt;h3 id=&quot;a-few-easy-steps&quot;&gt;A few easy steps&lt;/h3&gt;

&lt;h2 id=&quot;step-1-adding-the-rename-script-to-addigy&quot;&gt;Step 1) Adding the rename script to Addigy&lt;/h2&gt;

&lt;p&gt;The fastest way to do this is to copy it directly from the &lt;a href=&quot;https://prod.addigy.com/#/macmanage/community/scripts/5d6ea5515ff0a156d5abf064&quot;&gt;community item&lt;/a&gt; in the Addigy portal. Alternatively here is the script below. Don’t forget to add your company name.&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;getUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; /dev/console | &lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'{ print $3 }'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;hwIdentifier&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;sysctl &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; hw.model&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;serialNumber&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;system_profiler SPHardwareDataType | &lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/Serial/ {print $4}'&lt;/span&gt; | rev | &lt;span class=&quot;nb&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-5&lt;/span&gt; | rev&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;loggedInUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;finger &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$getUser&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-2&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 1 | &lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'{print$2}'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;company&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;COMPANYNAME&quot;&lt;/span&gt;


	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hwIdentifier&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;MacBookPro&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
		&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;set name to: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; ComputerName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; LocalHostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; HostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hwIdentifier&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;MacBookAir&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
		&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;set name to: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBA-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; ComputerName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBA-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; LocalHostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBA-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; HostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MBA-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hwIdentifier&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;iMac&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
		&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;set name to: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-IMAC-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; ComputerName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-IMAC-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; LocalHostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-IMAC-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; HostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-IMAC-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hwIdentifier&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;MacBook&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
		&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;set name to: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MB-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; ComputerName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MB-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; LocalHostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MB-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; HostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MB-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hwIdentifier&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;Macmini&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
		&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;set name to: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MM-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; ComputerName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MM-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; LocalHostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MM-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; HostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MM-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$hwIdentifier&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;MacPro&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
		&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;set name to: &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; ComputerName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; LocalHostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
		scutil &lt;span class=&quot;nt&quot;&gt;--set&lt;/span&gt; HostName &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$loggedInUser&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$company&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-MP-&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$serialNumber&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
/Library/Addigy/collector
/Library/Addigy/auditor
&lt;span class=&quot;c&quot;&gt;# Uncomment the next line if you're using Watchman Monitoring&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# /Library/MonitoringClient/RunClient -F&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;blockquote&gt;
  &lt;p&gt;If not not copying from the community item, add as a new script in Devices -&amp;gt; Manage&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;/images/copy-rename-script-to-addigy.png&quot;&gt;&lt;img src=&quot;/images/copy-rename-script-to-addigy.png&quot; alt=&quot;copy rename script in addigy&quot; /&gt;&lt;/a&gt; –&lt;/p&gt;

&lt;h2 id=&quot;step-2-add-the-maintenance-item&quot;&gt;Step 2) Add the maintenance item&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Go to Policies - Catalog and add a new maintenance item&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;/images/add-rename-script-as-maintenance-script.png&quot;&gt;&lt;img src=&quot;/images/add-rename-script-as-maintenance-script.png&quot; alt=&quot;Add rename script as maintenance script&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s it! To test it you can either wait for the specified time, or just go to Devices -&amp;gt; Select a device and run the script.
You should see something like the below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/rename-device-addigy.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Script was based on &lt;a href=&quot;https://macadmins.slack.com/archives/C07DL6QCQ/p1560948471148900&quot;&gt;this discussion&lt;/a&gt;&lt;/p&gt;</content><author><name>Stijn Brattinga</name></author><summary type="html">When onboarding new clients in Addigy I like to add a few maintenance scripts. One of these scripts automatically renames a Mac according to the logged in user, type of Mac (MacBook Pro, Mac mini etc), company name and last digits of serial number.</summary></entry></feed>