---
title: Rename a User Account
slug: homologacao-atmosphere/rename-a-user-account
description: Learn how to rename a user account effortlessly with this comprehensive PowerShell script. This document offers a summary of the script, including its parameters for the current and new username, along with practical usage examples. Discover the valuable 
createdAt: 2022-07-26T18:29:01.000Z
---

## Resumo

- Renomeia um usuário.

## Parâmetros

| **Parâmetro** | **Tipo** | **Escolhas \| Valor Padrão** | **Comentários**                 |
| ------------- | -------- | ---------------------------- | ------------------------------- |
| name          | string   |                              | Nome do usuário a ser alterado. |
| new\_name     | string   |                              | Novo nome a ser                 |

Utiliza parâmetros do módulo [Powershell Command](https://docs.simonops.com/homologacao-atmosphere/powershell-command).

## Exemplos

```yaml
- name: Rename a User Account
  powershell_command:
    server: "{{ input.server }}"
		port: "{{ input.port }}"
		ssl: "{{ input.ssl }}"
    username: "{{ input.username }}"
    password: "{{ input.password }}"
		show_errors: "{{ input.show_errors }}"
		show_warnings: "{{ input.show_warnings }}"
    command: |
      Rename-LocalUser -Name "{{ input.name }}" -NewName "{{ input.new_name }}" | ConvertTo-Json
  register: result

  - name: Rename a User Account SID
  powershell_command:
    server: "{{ input.server }}"
		port: "{{ input.port }}"
		ssl: "{{ input.ssl }}"
    username: "{{ input.username }}"
    password: "{{ input.password }}"
		show_errors: "{{ input.show_errors }}"
		show_warnings: "{{ input.show_warnings }}"
    command: |
      Rename-LocalUser -SID {{ input.sid }} -NewName "{{ input.new_name }}" | ConvertTo-Json
  register: result
```

## Valores retornados

| **Chave**        | **Tipo** | **Retornado quando** | **Descrição**              |
| ---------------- | -------- | -------------------- | -------------------------- |
| output           | string   | Sempre               | Saída da execução          |
| had\_errors      | boolean  | Sempre               | Se teve erros              |
| output\_errors   | string   | Sempre               | Erros de saída da execução |
| output\_warnings | string   | Sempre               | Avisos de saída            |

