A
A
Alexander Semenenko2019-12-12 12:48:28
WordPress
Alexander Semenenko, 2019-12-12 12:48:28

How to save credential for winrm?

I'm just learning how to control my computer remotely using powershell.
It turns out to connect like this:

Enter-PSSession -ComputerName 10.15.29.8 -Credential $crd

Before this command, you can save credential to the crd variable:
$crd = Get-Credential
But if I reopen powershell, then my variable $crdwill not remain.
How can I save the credential so that even after restarting the computer I can connect to a remote powershell without entering a password? At once I will notice that computers in different domains.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Orkhan Hasanli, 2019-01-20
@azerphoenix

Hello!
Rather, the problem is not in the wokomerc.
Check the following items:
- PHP version - PHP
configuration (memory_limit is desirable. It should be 256 and higher and other parameters)
- enable debugging in wp-config and check
- clear htaccess and re-create
- if the site was transferred, then check if everything is correct imported (DB)
- update permalink structure don't forget to replace urls and paths (better search replace plugin)

A
Alexander Semenenko, 2019-12-12
@semenenko88

Got it!
In order not to have to enter the password each time, we save it in encrypted form to a file:

$crd = Get-Credential
$crd.Password | ConvertFrom-SecureString | Set-Content pass.txt

Using the username and password from the file, create a Credential in a variable, and use this variable to connect to the server:
$user = ″domain\administrator″
$password = Get-Content pass.txt | ConvertTo-SecureString
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user, $password
Enter-PSSession -ComputerName 10.15.29.8 -Credential $cred

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question