# Export-Role

Exports (serializes) Sitecore roles to the filesystem on the server.

## Syntax

Export-Role \[-Identity] \<AccountIdentity> \[-Root \<String>]

Export-Role \[-Identity] \<AccountIdentity> -Path \<String>

Export-Role -Filter \<String> \[-Root \<String>]

Export-Role \[-Role] \<Role> \[-Root \<String>]

Export-Role \[-Role] \<Role> -Path \<String>

## Detailed Description

The Export-Role command exports (serializes) Sitecore roles to the filesystem on the server.

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

## Parameters

### -Identity \<AccountIdentity>

Specifies the Sitecore role by providing one of the following values.

```powershell
Local Name
    Example: developer
Fully Qualified Name
    Example: sitecore\developer
```

| Aliases                     |                |
| --------------------------- | -------------- |
| Required?                   | true           |
| Position?                   | 1              |
| Default Value               |                |
| Accept Pipeline Input?      | true (ByValue) |
| Accept Wildcard Characters? | false          |

### -Filter \<String>

Specifies a simple pattern to match Sitecore roles.

Examples: The following examples show how to use the filter syntax.

To get all the roles, use the asterisk wildcard: Export-Role -Filter \*

To get all the roles in a domain use the following command: Export-Role -Filter "sitecore\*"

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | true  |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Role \<Role>

Specifies the role to be exported

| Aliases                     |                |
| --------------------------- | -------------- |
| Required?                   | true           |
| Position?                   | 1              |
| Default Value               |                |
| Accept Pipeline Input?      | true (ByValue) |
| Accept Wildcard Characters? | false          |

### -Path \<String>

Path to the file the role should be saved to.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | true  |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Root \<String>

Specifies the serialization root directory. If this parameter is not specified - the default Sitecore serialization folder will be used (unless you're saving to an explicit location with the -Path parameter).

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

## Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

* System.String

  Sitecore.Security.Accounts.Role

## Outputs

The output type is the type of the objects that the cmdlet emits.

* System.String

## Notes

Help Author: Adam Najmanowicz, Michael West

## Examples

### EXAMPLE 1

```powershell
PS master:\> Export-Role -Identity sitecore\Author
```

### EXAMPLE 2

```powershell
PS master:\> Export-Role -Filter sitecore\*
```

### EXAMPLE 3

```powershell
PS master:\> Export-Role -Root C:\my\Serialization\Folder\ -Filter *\*
```

### EXAMPLE 4

```powershell
PS master:\> Export-Role -Path C:\my\Serialization\Folder\Authors.role -Identity sitecore\Author
```

## Related Topics

* [Import-Role](/appendix/security/import-role.md)
* [Export-User](/appendix/security/export-user.md)
* [Import-User](/appendix/security/import-user.md)
* [Export-Item](/appendix/packaging/export-item.md)
* [Import-Item](/appendix/security/export-role.md)
* <https://github.com/SitecorePowerShell/Console/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.sitecorepowershell.com/appendix/security/export-role.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
