title: Registering A record in DNS remotely using powershell
body: <p>Below is my script, Please let me know if am missing something.</p>
  
  <pre><code>#Script to add DNS 'A' Records 'PTR' Records to DNS Servers
  $dns = "afidc1.XXXXXXX.com" # Your DNS Server Name
  $Zone = "XXXXXXX.com" # Your Forward Lookup Zone Name
  $IP = "X.X.X.X" 
  $Name = "pweb17s1"
  $localuser = "XXXXXX\mayigi01"
  $localpass = "XXXXXX"
  Enter-PSSession –ComputerName $dns -GuestCredential $localuser $localpass
  Import-Module DnsServer
  Add-DnsServerResourceRecordA –ComputerName $dns -Name $Name -IPv4Address $IP -ZoneName $Zone
  </code></pre>
  
  <p>Below is the error am facing:</p>
  
  <pre><code>Enter-PSSession : A positional parameter cannot be found that accepts argument 'â€ComputerName 'afidc1.XXXXX.com'
  -GuestCredential XXXXX\mayigi01 XXXXX
  Import-Module DnsServer
  Add-DnsServerResourceRecordA â€ComputerName'.
  At C:\Users\devoops!\Desktop\dns.ps1:9 char:1
  + Enter-PSSession â€“ComputerName 'afidc1.XXXXX.com' -GuestCredential $localus ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidArgument: (:) [Enter-PSSession], ParameterBindingException
      + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.EnterPSSessionCommand
  </code></pre>