Rename del computer tramite riga di comando e accesso remoto

Per modificare il nome di un computer in dominio è possibile utilizzare l’utility NetDom (disponibile nei Support Tools per XP e Vista) tramite la seguente sintassi:

  • In locale:
    Netdom renamecomputer %computername% /NewName:NEWNAME
  • Da remoto:
    • Netdom renamecomputer old-name /NewName:new-name /UserD:domainname\administrator /PasswordD:*
      (tramite il parametro /PasswordD:* verrà richiesto di digitare la password dell’aministratore di dominio)
    • Netdom renamecomputer old-name /NewName:new-name /UserD:domainname\administrator /PasswordD:password

Per modificare il nome di un computer in workgroup è possibile utilizzare WMI (Windows Management Instrumentation) tramite l’utility wmic:

  • In locale:
    wmic computersystem where name=”%computername%” rename name=”new-name”
  • Da remoto:
    • wmic /NODE:old-name /user:old-name\administrator computersystem where name=”old-name” rename name=”new-name”
      (verrà richiesto di digitare la password dell’aministratore di dominio)
    • wmic /NODE:old-name /userR:old-name\administrator /password:password computersystem where name=”old-name” rename name=”new-name”

Ovviamente per poter modificare il nome di un computer remotamente occorre che siano verificate alcune condizioni:

  1. L’eventuale firewall sul computer remoto deve consentire le connessioni DCOM verco il computer remoto per ulteriori informazioni si vedano Connecting Through Windows Firewall e Connecting to WMI Remotely Starting with Windows Vista.
  2. In Vindows Vista e successivi le connessioni remote sono interessate dalla UAC se non ci si connette tramite un account appartenente ai built-in Administrators. A riguardo si veda User Account Control and WMI.
  3. Nel caso sia abilita la Condivisine di file semplice l’accesso remoto non è consentito. Dal seguente How to configure file sharing in Windows XP:
  4. When Simple File Sharing is turned on, remote administration and remote registry editing does not work as expected from a remote computer, and connections to administrative shares (such as C$) do not work because all remote users authenticate as Guest. Guest accounts do not have administrative rights. When Simple File Sharing is turned on, if you configure specific user ACEs, remote users are not affected when Simple File Sharing is turned on because all remote users authenticate as Guest when Simple File Sharing is turned on.
    Remote users may receive an “Access Denied” message on a share that they had connected to successfully before. This behavior occurs after the hard disk is converted to NTFS. This behavior occurs on Windows XP-based computers that have Simple File Sharing turned on that were upgraded from Windows 98, Windows 98 Second Edition, or Windows Millennium Edition. This behavior occurs because the default permissions of a hard disk that is converted to NTFS do not contain the Everyone group. The Everyone group is required for remote users who are using the Guest account to access the files To reset the permissions, stop sharing, and reshare the affected folders.