Jump to content

JanSnow

Members
  • Posts

    4
  • Joined

  • Last visited

Reputation Activity

  1. Like
    JanSnow got a reaction from Mark G38 in Update Computer Name with Logged on Username   
    I did create a scope to exempt the machines but I'll keep this script for future reference. Thanks mate!
  2. Like
    JanSnow reacted to Mark G38 in Update Computer Name with Logged on Username   
    Don't run it against those machines. Create a scope in Pulseway and apply the job / script to that scope and don't include those machines.  

    If you don't want to do that, then modify the script and using this.  Change the PCNames to the ones you don't want it to run on, and then yea, it will just exit with a success if it sees those names.  If you are on machines that are all PowerShell 3.0 and above, then you can also use $env:computername -in $Exclusions as well.  -contains is PowerShell 2 compatible.
     
      $Exclusions = @("PCName1", "PCName2", "PCName3")   if ($Exclusions -contains $env:COMPUTERNAME) {     Exit 0 } else {     PLACE REST OF CODE HERE }
×
×
  • Create New...