Forum Discussion

wiktormalyska's avatar
wiktormalyska
Copper Contributor
Aug 12, 2024

Powershell Profiles

Hi! I would like to create profiles for powershell that on launch run commands like ssh to autoconnect to server. I tried making powershell profiles in window but besides of just existing it hasn't changed anything. When using command New-Item -Path $profile.CurrentUserCurrentHost -ItemType File -Force
It is making profile used by whole powershell. How can i change that so profile for ex. HPServer launches different commands and RPIServer other?

 

  • wiktormalyska If it's just SSH, I would use ssh.exe username@123.123.123.123 in the profile command line. If you want to run something specific in a certain profile when using Terminal:

     

    - Create a new profile which starts powershell.exe or pwsh.exe

    - Start the new profile

    - Run $env:wt_profile_id and note that {guid} 

    - notepad $profile and add

    if ($env:wt_profile_id -eq '{123123abc-1234-5678-1234-123123123asdad}' {code to execute}

    - Start the new profile again, and it should start the thing you specified in {code to execute} 

     

    I tested it just now, and it should work 🙂

     

     

Resources