• 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
    }

  • 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 Group logo of PowerShellPowerShell 1 year, 2 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)

  • Gideon Kay became a registered member 1 year, 2 months ago

    avataravatar
© 4sysops 2006 - 2022

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account