|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 | |
|
Member
Iscritto dal: Jul 2015
Messaggi: 275
|
Remote PowerShell esempi
Buongiorno a tutti,
mi hanno chiesto se in un server win 2008/2012 è possibile attivare il PowerShell Remoto. Ho cercato su google e ho trovato alcune risposte, in particolar modo questi due comandi: Codice:
winrm s winrm/config/client '@{TrustedHosts="ComputerRemoto"}'
Set-Item WSman:\localhost\client\TrustedHosts\ -value "*" -Force
Nel cercare una guida ho trovato una pagina MS dove dice di guarddare sui sistemi Win2008 la guida introduttiva.. ma nei sistemi che abbiamo non c'è Inoltre mi domandavo se PowerShell avesse bisogno di porte particolari per funzionare o se usa le porte di RemoteDesktop.. Grazie edit Ho trovato le porte di default: Quote:
Ultima modifica di c3n2o : 01-08-2016 alle 09:01. |
|
|
|
|
|
|
#2 |
|
Member
Iscritto dal: Jul 2015
Messaggi: 275
|
Ciao a tutti,
Ho trovato il comando più semplice (presumo): Codice:
Enter-PSSession -ComputerName gigi Allora sul server win2012 di nome gigi ho dato (spero) i permessi del firewall e inoltre con gpedit ho modificato (sotto "computer config>Admin Templates> Network> Network connections>Windows firewall> Domain Profile") la voce windows firewall: Define inbound program exception aggiungendo le 2 porte (in realtà nella guida che ho trovato c'era solo la prima porta) Codice:
5985:TCP:*:Enabled:WinRM 5986:TCP:*:Enabled:WinRM Codice:
PS C:\Windows\system32> Enter-PSSession -ComputerName gigi
Enter-PSSession : Connecting to remote server failed with the following error
message : The WinRM client cannot process the request. If the authentication
scheme is different from Kerberos, or if the client computer is not joined to a
domain, then HTTPS transport must be used or the destination machine must
be added to the TrustedHosts configuration setting. Use winrm.cmd to
configure TrustedHosts. Note that computers in the TrustedHosts list might
not be authenticated. You can get more information about that by running the
following command: winrm help config. For more information, see the
about_Remote_Troubleshooting Help topic.
At line:1 char:16
+ Enter-PSSession <<<< -ComputerName gigi
+ CategoryInfo : InvalidArgument: (gigi:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
Dove sto sbagliando? Devo abilitare forse qualcosa anche nel mio PC? Grazie ancora |
|
|
|
|
|
#3 |
|
Member
Iscritto dal: Nov 2007
Messaggi: 63
|
Ma scusa, questi due computer sono nello stesso dominio?
Dal computer dal quale vuoi accedere, il 'ping gigi' ti funziona? Il DNS è a posto? |
|
|
|
|
|
#4 |
|
Member
Iscritto dal: Jul 2015
Messaggi: 275
|
Ciao,
Sì, nel test che sto facendo sono sullo stesso dominio.. ma poi nella pratica mi sa di no.. o per lo meno uno dei PC dovrà essere collegato tramite VPN alla rete del server (dove mandare i comandi PowerShell) Cmq il problema era che dovevo farmi chiedere la pwd.. quindi ho risolto col comando: Codice:
Enter-PSSession –ComputerName RemoteHost –Credential User Grazie |
|
|
|
|
|
#5 |
|
Member
Iscritto dal: Nov 2007
Messaggi: 63
|
Su VPN funziona se passano le porte giuste; se non hai fw di mezzo non avrai problemi.
Sul discorso credential, lui di default usa il tuo utente. Ovviamente se il tuo utente non ha accesso alla macchina a cui vuoi collegarti, devi specificare che utente vuoi utilizzare. Ad ogni modo vale quanto sopra! |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 23:24.



















