title: Custom PowerShell Label script
body: <p>Asking for a bit of help on my script. I would like to get a list saved to a thumb drive with the computer name and the WAN address. I know I can add a custom label with the computer name but would get the default name. I already set the computer to change the name on reboot but I do not want to reboot as there are other things that need to happen before rebooting. The computers are new and are not added to the domain. I have a thumb drive that will auto load and assists in changing the name without asking to reboot. So other software can install.</p>
  <p>This is what I have so far:</p>
  <pre><code>getmac /v /FO CSV | ConvertFrom-Csv | Select-Object @{n='ComputerName';e={$env:COMPUTERNAME}},'Physical Address','Connection Name' | Where-Object { $_.'Connection Name' -Match 'Wi-Fi' }
  </code></pre>
  <p>And this is the output:</p>
  <pre><code>ComputerName        Physical Address    Connection Name
  ------------------ ------------------ --------------------
  Desktop-9K293       XX-XX-XX-XX-XX          Wi-Fi
  </code></pre>
  <p>I want the ComputerName to be the new name before rebooting. This way I can add an <code>Export-CSV ~Location\MAC_Report.CSV -NoTypeInformation -append</code> at the end of that code. Is there a way? Or do I need to restart the computer and generate that CSV using the same code?</p>
  <p>I would love it to look:</p>
  <pre><code>ComputerName        Physical Address    Connection Name
  ------------------ ------------------ --------------------
  NEW_____Name         XX-XX-XX-XX-XX          Wi-Fi
  </code></pre>
  <p>There are a lot of things I can make my thumb drive do. This way I have fewer restarts before adding the rest of the software(s) that also requires a restart. This way I cut my restart to one, on both all the software and computer rename.</p>