Enable remote powershell on non domain joined computers in batch (not powershell)

Hi,

I'd like to enable remote powershell on some non domain joined computers (which all have same admin/pw which I can use to remotely connect).
How can I do that without going on each machine per machine (psexec or other?)

Please advise, is there some cmd script I could use?

J.
janhoedtAsked:
Who is Participating?
 
janhoedtConnect With a Mentor Author Commented:
Done via psexec and works fine.
1
 
janhoedtAuthor Commented:
#THE IDEA = RUN PSEXEC TEST, WHEN WORKING, RUN THE ENABLE REMOTE PS COMMANDS

$Computername = 'computer01'
$Username = 'myuser'
$Password = 'MyPassword'
#$command = 'ipconfig'
$command = "dir 'c:\windows\temp' && echo 'hello'"
PsExec.exe \\$Computername -u $Username -p $Password /accepteula cmd  /c "powershell -noninteractive -command $command"

<#Enable remote powershell
Enable-PSRemoting -Force
Set-Item WSMan:\localhost\Client\TrustedHosts * -Force
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1000
Enable-WSManCredSSP -Role Server -Force
Restart-Service WinRM
#>
1
All Courses

From novice to tech pro — start learning today.