-
Gideon Kay started the topic Disable WinRM Remotely -> removing listeners in
PowerShell Forum 7 months, 4 weeks ago
Hi group,
I am trying to disable WinRM remotely and it looks good except the section where I remove the Listeners a message pops up regarding connectivity to the server (PC) was lost. I believe the listeners have been removed by then.
‘Network Connection Interrupted. Attempting to reconnect for up to 4 minutes.’
Any ideas will be greatly appreciated.
Regards, Gideon.Write-host “Remove Listeners”
Invoke-Command -ComputerName ESS-XXX-REP -ScriptBlock {
Remove-Item -Path WSMan:Localhostlistenerlistener* -Recurse
pause
} -
-
Gideon Kay commented on
Add a user to the local Administrators group on a remote computer 1 year, 10 months ago
For the Powershell option, the last line, $AdminGroup.Add($User.Path), gives an exception message:
Exception calling "Add" with "1" argument(s): "An invalid directory pathname was passed"
At tsclientDPassword EmailRemote command.ps1:6 char:1
+ $groupObj.Add($userObj.Path)What gives? Can't figure out the error.
-
Gideon Kay posted an update in the group
PowerShell 1 year, 10 months ago
Can’t get passed the error generated by this script, please help.
I’m trying to add a domain user to the ‘administrators’ group on a remote computer. I am logged in on my PC as the local administrator.
The last line is problematic.
Regards, Gideon.$computer = ‘ESS-Brapczak’
$domainUser = ‘abcd/myname’
$group = ‘Administrators’
$groupObj =[ADSI]”WinNT://$computer/$group,group”
$userObj = [ADSI]”WinNT://$domainUser,user”
$groupObj.Add($userObj.Path)Exception calling “Add” with “1” argument(s): “An invalid directory pathname was passed
”
At \tsclientDPassword EmailRemote command.ps1:6 char:1
+ $groupObj.Add($userObj.Path) -
-