Start ps function remotely on server

Welcome Forums General PowerShell Q&A Start ps function remotely on server

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year, 9 months ago.

  • Author
    Posts
  • #70742

    Participant
    Points: 0
    Rank: Member

    I wrote little function which resets user's password.
    When i connect to server and start this function it work very well.
    I want to start it on my pc but run it on remotely server.
    It look like this:

    1) I start my script on my PC;
    2) It connect to server (Enter-PsSession)
    3) it run on server;
    4) Close server connection

    function Reset-AsstraUserPassword{
        
        [CmdletBinding()]
        param(
            [string]$UserName = (Read-Host "Enter User Name for Reset Password"),
            $message = ("##### User Password has been reset to:").ToUpper()
            )
    
        Set-ADAccountPassword -Identity $UserName -Reset -NewPassword (ConvertTo-SecureString "password" -AsPlainText -Force)
    
        Write-Host $message "password #####"
    
    }

    Could you help me pls with it ?

  • #70748

    Participant
    Points: 22
    Rank: Member

    Moving to correct forum.

    • #70754

      Participant
      Points: 0
      Rank: Member

      Hello, Adam.

      Thank you for moving my post to correct forum.
      I'm sorry for wrong post.

The topic ‘Start ps function remotely on server’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort