> 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/rdm/fr/knowledge-base/troubleshooting-articles/test-secret-server-access-with-a-powershell-script.md).

# Tester l'accès au serveur secret avec un script PowerShell

Utilisez le script PowerShell suivant pour vérifier qu'un poste de travail client peut se connecter à Secret Server et effectuer une recherche de secret de base.

1. Enregistrez le code dans un fichier appelé `searchsecret.ps1`.
2. Modifiez le script selon vos besoins pour qu'il corresponde à votre Secret Server et à votre nom d'utilisateur/mot de passe/domaine.
3. Modifiez le `$searchterm` pour qu'il corresponde à votre recherche.

Cela vous permettra de tester la connectivité entre votre poste de travail et votre Secret Server.

```powershell
$url = 'http<area>://mysecretserver/webservices/sswebservice.asmx'
$username = 'myusername'
$password = 'mypassword'
$domain = 'mydomain'   # leave blank for local users

$searchterm = 'VPN'
$proxy = New-WebServiceProxy -uri $url -UseDefaultCredential

# Get a token for further use by authenticating using username/password.
$result1 = $proxy.Authenticate($username, $password, '', $domain)
if ($result1.Errors.length -gt 0){
$result1.Errors[0]
exit
}
else
{
$token = $result1.Token
}

# search secrets with our searchterm (authenticate by passing in our token)
Write-Host 'Searching for: ' $searchterm
$result2 = $proxy.SearchSecrets($token, $searchterm,$null,$null)
if ($result2.Errors.length -gt 0){
$result2.Errors[0]
}
else
{
Write-Host 'Got search results: ' $result2.SecretSummaries.length

# If you want the data as XML

# $xml = convertto-xml $result2.SecretSummaries -As string -Depth 20

# $xml

$result2.SecretSummaries | ForEach-Object { Write-Host 'SecretId:' $_.SecretId '  Name:' $_.SecretName  ' FolderId:' $_.FolderId }

# if ($result2.SecretSummaries.length -gt 0) {

# $result2.SecretSummaries[0]

# }

}
```


---

# 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 dynamically by asking a question.

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

```
GET https://docs.devolutions.net/rdm/fr/knowledge-base/troubleshooting-articles/test-secret-server-access-with-a-powershell-script.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.
