> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell/da/readme.md).

# Overview of Devolutions PowerShell

Gennemse dokumentationen til Devolutions PowerShell, som dækker modulet Devolutions.PowerShell og cmdlets til Remote Desktop Manager, Server, Cloud og Gateway.

Devolutions-produkterne integrerer Microsoft PowerShell fuldt ud og giver stærke muligheder for scripting og automatisering. De kan styre selve Devolutions-produkterne og via Remote Desktop Manager køre PowerShell-scripts i hele Deres miljø. Her er, hvordan PowerShell bruges på tværs af Devolutions-platformen.

| Integration                                                                            | Formål                                                                                                                               | Reference                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Devolutions.PowerShell-modul                                                           | Dette PowerShell-modul bruges til at arbejde direkte med Devolutions-produkter.                                                      | <ul><li><a href="https://www.powershellgallery.com/packages/Devolutions.PowerShell/">PowerShell Gallery</a></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Handlinger i Remote Desktop Manager                                                    | De kan definere et PowerShell-script, der køres som en batchhandling mod en eller flere værter.                                      | <ul><li><a href="/powershell/da/remote-desktop-manager-powershell/powershell-scripting/custom-powershell-commands.md">Brugerdefinerede PowerShell-kommandoer</a></li><li><a href="/powershell/da/remote-desktop-manager-powershell/batch-edit-folders-with-custom-powershell-commands.md">Masseredigering med PowerShell</a></li><li><a href="/powershell/da/remote-desktop-manager-powershell/powershell-scripting/custom-powershell-commands/modify-the-source-of-entries-added-by-a-synchronizer.md">Ændring af en synkroniseringskilde</a></li></ul> |
| Rapporter i Remote Desktop Manager                                                     | Denne posttype understøtter kørsel af et PowerShell-script, der genererer en rapport.                                                | <ul><li><a href="/powershell/da/remote-desktop-manager-powershell/create-a-report-custom-entry.md">Brugerdefineret PowerShell-rapport</a></li></ul>                                                                                                                                                                                                                                                                                                                                                                                                      |
| Posttyper i Remote Desktop Manager                                                     | Både de lokale og de eksterne PowerShell-posttyper understøtter kørsel af scripts.                                                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Udbydere til administration af privilegeret adgang (PAM) og udbredelse af adgangskoder | I Devolutions Server og Devolutions Cloud driver PowerShell brugerdefinerede PAM-udbydere og scripts til udbredelse af adgangskoder. | <ul><li><a href="https://docs.devolutions.net/pam/pam-with-devolutions-server/getting-started/custom-pam-providers/create-a-custom-pam-provider-in-devolutions-server">Brugerdefineret PAM-udbyder i Devolutions Server</a></li><li><a href="https://docs.devolutions.net/pam/pam-with-devolutions-server/password-propagation-scripts">Scripts til udbredelse af adgangskoder i Devolutions Server PAM</a></li></ul>                                                                                                                                    |

### Kom i gang med Devolutions.PowerShell-modulet

Devolutions.PowerShell-modulet kræver [PowerShell 7.4 eller nyere](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.4) og understøttes på operativsystemerne Windows, macOS og Linux.

{% hint style="warning" %}
Windows PowerShell og tidligere versioner af PowerShell 7 understøttes ikke, fordi modulet er bygget på samme kerne som Remote Desktop Manager og derfor kræver en version af PowerShell med en kompatibel version af .NET-runtime (.NET 9).
{% endhint %}

#### PowerShell Gallery (anbefalet)

Devolutions.PowerShell-modulet findes i [PowerShell Gallery](https://www.powershellgallery.com/packages/Devolutions.PowerShell), og det er den anbefalede standardinstallationsmetode:

```powershell
Install-Module Devolutions.PowerShell -Force
```

Da PowerShell Gallery normalt er et lager, der er markeret som ikke-betroet (pakkerne kurateres eller gennemgås ikke), skal `-Force` bruges for at undgå bekræftelsesprompten.

#### Cloudsmith

Som alternativ til PowerShell Gallery tilbyder vi et [Devolutions PowerShell-lager](https://cloudsmith.io/~devolutions/repos/powershell/packages/), der hostes af [Cloudsmith](https://cloudsmith.com/).

1. Registrer Devolutions PowerShell-lageret, som kan markeres som betroet:

   ```powershell
   Register-PSRepository -Name 'Devolutions' -SourceLocation 'https://nuget.cloudsmith.io/devolutions/powershell/v2/' -InstallationPolicy Trusted
   ```
2. Afinstaller tidligere versioner af Devolutions.PowerShell-modulet, der er installeret fra PowerShell Gallery:

   ```powershell
   Uninstall-Module Devolutions.PowerShell -AllVersions
   ```
3. Installér Devolutions.PowerShell-modulet udtrykkeligt fra lageret "Devolutions":

   ```powershell
   Install-Module Devolutions.PowerShell -Repository Devolutions
   ```
4. Bekræft, at installationskilden for Devolutions.PowerShell-modulet er "Devolutions" og ikke "PSGallery":

   ```powershell
   Get-InstalledModule Devolutions.PowerShell | Select-Object -Property Name, Repository

   Name                   Repository
   ----                   ----------
   Devolutions.PowerShell Devolutions
   ```

{% hint style="info" %}
Da Devolutions.PowerShell-modulet findes i mere end ét registreret lager, er parameteren `-Repository` obligatorisk. Hvis De har markeret lageret "Devolutions" som betroet, er `-Force` ikke nødvendig for at undgå bekræftelsesprompten.
{% endhint %}

#### Offline

Hvis De skal installere Devolutions.PowerShell-modulet på et system med begrænset eller ingen internetadgang, kan De følge disse trin:

1. Opret et nyt PowerShell-lager med navnet "local" i den mappe, De vælger. Eksemplet nedenfor bruger `C:\PSRepo`.

   ```powershell
   $RepoPath = "C:\PSRepo"
   New-Item -Path $RepoPath -ItemType 'Directory' -Force | Out-Null
   Register-PSRepository -Name 'local' -SourceLocation $RepoPath -PublishLocation $RepoPath -InstallationPolicy Trusted
   ```
2. Download filen `.nupkg` til Devolutions.PowerShell-modulet med knappen ***Download the raw nupkg file*** under ***Manual Download*** i [PowerShell Gallery](https://www.powershellgallery.com/packages/Devolutions.PowerShell). Kopiér filen `.nupkg` til den lokale PowerShell-lagermappe, De oprettede tidligere.
3. Afinstaller tidligere versioner af Devolutions.PowerShell-modulet, der er installeret fra andre kilder.

   ```powershell
   Uninstall-Module Devolutions.PowerShell -AllVersions
   ```
4. Installér Devolutions.PowerShell-modulet udtrykkeligt fra lageret `local`.

   ```powershell
   Install-Module Devolutions.PowerShell -Repository local
   ```
5. Bekræft, at installationskilden for Devolutions.PowerShell-modulet er `local`.

   ```powershell
   Get-InstalledModule Devolutions.PowerShell | Select-Object -Property Name, Repository

   Name                   Repository
   ----                   ----------
   Devolutions.PowerShell local
   ```

{% hint style="info" %}
En mappe på et netværksshare kan også bruges i stedet for en lokal mappe, så det er lettere at distribuere PowerShell-modulet på et lokalt netværk.
{% endhint %}

### Eksempler

Læs videre nedenfor for hurtigt at komme i gang med almindelige eksempler på Devolutions.PowerShell-modulet.

#### Remote Desktop Manager

```powershell
# [Import module]
Import-Module Devolutions.PowerShell

# [Load workspace] Example for a local workspace (SQLite) or SQL Server
$DatasourceLocal = Get-RDMDataSource -Name "Local workspace"; Set-RDMCurrentDataSource $DatasourceLocal

$DatasourceSQL = Get-RDMDataSource -Name "SQL Server"; Set-RDMCurrentDataSource $DatasourceSQL

# [Create vault] Only the SQL Server workspace supports vaults (as do Devolutions Server and Devolutions Cloud)
$Vault = New-RDMRepository -Name 'MyVault' -Description 'My vault description' -SetRepository | Set-RDMCurrentRepository | Update-RDMUI

# [Retrieve vault]
Get-RDMRepository -Name 'MyVault'

# [Create entry] Example to create an RDP and Credential entry
$Entry = New-RDMSession -Host 'MyHost' -Type RDPConfigured -Name 'MyHost'; Set-RDMSession -Session $Entry -Refresh; Update-RDMUI

$Entry = New-RDMSession -Name 'MyCredential' -Type Credential; $Entry.Credentials.Username = 'Administrator'; Set-RDMSession $Entry -Refresh; Set-RDMSessionPassword -ID $Entry.ID -Password (ConvertTo-SecureString 'Test123$' -AsPlainText -Force)

# [Retrieve entries]
Get-RDMSession -GroupName 'MyFolder' -Name 'MyHost'

# [Update entry]
$Entry = Get-RDMSession -Name 'MyHost'; $Entry.Name = 'MyUpdatedHost'; Set-RDMSEssion $Entry | Update-RDMUI

# [Export entries]
$Entries = Get-RDMSession; $Entries | Select-Object * | Export-CSV 'C:\Export\FileName.csv' -NoTypeInformation

# [Remove entry]
Get-RDMSession -Name 'MyUpdatedHost' | Remove-RDMSession; Update-RDMUI
```

#### Devolutions Server

```powershell
# [Import module]
Import-Module Devolutions.PowerShell

# [Load workspace]
New-DSSession -Credential (Get-Credential) -BaseURI 'https://MyServer/devolutions-server/'

# [Create vault]
$Vault = New-DSVault -Name 'MyVault' -Description 'My vault description'

# [Retrieve vault]
Get-DSVault -All | Where-Object DisplayName -EQ 'MyVault'

# [Create entry]
New-DSRDPEntry -Name 'MyHost' -HostName 'MyHost' -Username 'Administrator' -Password 'Test123$' -Domain 'MyDomain' -VaultID 'VaultGUID'

New-DSCredentialEntry -Name 'MyCredential' -Username 'Administrator' -Password 'Test123$' -Domain 'MyDomain' -VaultID 'VaultGUID'

# [Retrieve entries]
Get-DSEntry -FilterBy 'Name' -FilterMatch 'StartsWith' -FilterValue 'MyHost' -SearchAllVaults

# [Update entry]
$Entry = Get-DSEntry -EntryId 'EntryGUID'; $Entry.Name = 'MyUpdatedHost'; Update-DSEntryBase -JsonBody (ConvertTo-JSON -InputObject $Entry -Depth 10)

# [Export entries]
$Entries = Get-DSEntry -SearchAllVaults; $Entries | Select-Object * | Export-CSV 'C:\Export\FileName.csv' -NoTypeInformation

# [Remove entry]
Remove-DSEntry -EntryID 'EntryGUID'
```

#### Devolutions Cloud

```powershell
# [Import module]
Import-Module Devolutions.PowerShell

# [Load workspace]
Connect-DCAccount -Url 'https://mycloud.devolutions.app' -ApplicationKey 'ApplicationKey' -ApplicationSecret 'ApplicationSecret'

# [Create vault]
$Vault = New-DCVault -VaultName 'MyVault' -VaultDescription 'My vault description'

# [Retrieve vault]
Get-DCVault

# [Create entry]
$Entry = [Devolutions.Hub.PowerShell.Entities.Hub.PSDecryptedEntry]@{
    PsMetadata = [Devolutions.Hub.PowerShell.Entities.Hub.PSEntryMetadata]@{
        Name = 'MyHost'
        ConnectionType = [Devolutions.RemoteDesktopManager.ConnectionType]::Credential
    }
    Connection = [Devolutions.RemoteDesktopManager.Business.Connection]@{
        Credentials = [Devolutions.RemoteDesktopManager.Business.CredentialsConnection]@{
            CredentialType = [Devolutions.RemoteDesktopManager.CredentialResolverConnectionType]::Default
            UserName = 'Administrator'
            Password = 'Test123$'
        }
    }
}

New-DCEntry -VaultId 'VaultGUID' -PSDecryptedEntry $Entry

# [Retrieve entries]
Get-DCEntry -VaultId 'VaultGUID' | Where-Object { $PSItem.PSMetaData.Name -EQ 'MyHost' }

# [Update entry]
$Entry = Get-DCEntry -VaultId 'VaultGUID' -EntryId 'EntryGUID'; $Entry.PsMetadata.Name = 'MyUpdatedHost'; Set-DCEntry -VaultId 'VaultGUID' -EntryId $Entry.Entry.ID.Guid -PSDecryptedEntry $Entry

# [Export entries]
$Entries = Get-DCEntry -VaultId 'VaultGUID'; $Entries | Select-Object * | Export-CSV 'C:\Export\FileName.csv' -NoTypeInformation

# [Remove entry]
Remove-DCEntry -VaultId 'VaultGUID' -EntryId 'EntryGUID'
```

### Afinstallation af Devolutions.PowerShell-modulet

Afinstaller alle versioner af Devolutions.PowerShell-modulet:

```powershell
Uninstall-Module Devolutions.PowerShell -AllVersions
```

Hvis modulet er installeret via Cloudsmith, kan De fjerne registreringen af lageret "Devolutions" sådan:

```powershell
Unregister-PSRepository Devolutions
```

Hvis De har installeret modulet offline, kan De til sidst fjerne registreringen af det filbaserede lager "local" og slette den tilhørende mappe (mappenavnet kan være et andet):

```powershell
Unregister-PSRepository local
Remove-Item "C:\PSRepo" -Recurse -ErrorAction SilentlyContinue
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell/da/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
