Powershell Profiles

Copper Contributor

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_0-1723480063494.pngwiktormalyska_1-1723480070995.png

 

2 Replies

@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 🙂

 

 

Did that work out for you?