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

1 year, 1 month ago.

  • Author
  • #97200

    Topics: 6
    Replies: 13
    Points: 1
    Rank: Member

    I want to start a Landesk remote session with powershell.

    I have a computer name parameter but i need to add https:// before the computer name and :4343 after the computer name.

    How to add this to the function?

    function Start-LDRemote {
                 [Parameter(Mandatory = $True)] 
                 [string]$computername = $env:COMPUTERNAME
    Start-Process -FilePath $computername
    } ; Start-LDRemote
  • #97205

    Topics: 2
    Replies: 437
    Points: 875
    Helping Hand
    Rank: Major Contributor
    Start-Process -FilePath "https://${computername}:4343"

    In most cases, you wouldn't need the braces, but since colons are used for variable scopes, you do need them so PS doesn't think the 4343 is part of the variable itself.

    Double-quoted strings can expand variables on their own, so this should work just fine. 🙂

The topic ‘Function’ is closed to new replies.

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