PowerTip: Restore Default PSSession Endpoints

PowerTip: Restore Default PSSession Endpoints

  • Comments 3
  • Likes

Summary: Learn how to restore default PSSession endpoints.

Hey, Scripting Guy! Question How do I restore my default PSSession endpoints if I accidently unregistered them?

Hey, Scripting Guy! Answer Use Enable-PSRemoting to automatically rebuild the remote endpoints on your system:

Get-PSSessionConfiguration

Enable-PSRemoting –Force

#Now try it again

Get-PSSessionConfiguration

 

Name          : Microsoft.PowerShell

PSVersion     : 4.0

StartupScript :

RunAsUser     :

Permission    : BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed

 

Name          : Microsoft.Powershell.Workflow

PSVersion     : 4.0

StartupScript :

RunAsUser     :

Permission    : BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed

 

Name          : Microsoft.PowerShell32

PSVersion     : 4.0

StartupScript :

RunAsUser     :

Permission    : BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi, I really hope you see this and save me from my misery. I am by no means a pro at powershell, I am, however, a soon to be Master in Computer Science so programming is not foreign to me. But I can for the love of God and all kinds of bad words not figure out how to get this simple alias to work.

    I basically have 3 directories I'm working in a lot (all with a git hook). Those one of those are in one drive, and the other 2 on another drive. This works fine:

    cd C:\path_to_repo
    cd D:\path_to_repo

    When I alter between my C and D path I can even just go cd D: and it will automaticly go to my last location (which is nice), but when I try to alias it, it simply will not work. I've tried all sorts of combinations and variants of:

    Set-Alias repo1 cd D:\path
    Set-Alias repo1 "cd D:\path"
    Set-Alias repo1 D: | cd path

    And so on and so on. I've tried with Set-Location also, but as far as I can understand cd is merely an alias for this cmdlet. I cannot fathom how it can be so complicated to get something this simple to work? Hope you can help.

    Cheers

  • @Tquila

    D: is actually a function for Set-Location D:\ (Try 'Get-Command D: | Select *' to see this).

    Aliases are used for single command shortcuts, and you cannot specify an alias to run a command unless you have already defined it. In your case of wanting to use repo1 as a shortcut to D:\Path, you would probably be better off using New-PSDrive instead.

    New-PSDrive -Name repo1 -Provider FileSystem -Root D:\Path

    Then you can just to cd repo1: to get to that drive.

    If you still want a quicker approach to do this, you can go with this approach:

    Function repo1 {Set-Location D:\Path}

    All you need to do is type repo1 and it will take you there.

  • @Boe Prox

    Thank you! This solved everything. Another question, have you had any experience with ConEmu? I been using it lately and it seems to synergize amazingly with PowerShell - if you have any tips in that regards please do make a post about it.