-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMachineProfile: Avoid creation of user profiles on remote machines? #107
Comments
You need to register your PS Configuration with the NoProfile option on the remote host then connect to that configuration using the name as the value of |
Thanks for pointing me in the right direction on this. I finally have time to look into it again. The problem I'm having is that I don't have the ability to log in to thousands of machines to create a new PSConfiguration first before using WinRM with them. If I did this, then it would create the undesirable user profile during that first session! The
Is there an equivalent with your module? |
My apologies I thought you were talking about the Lines 93 to 94 in c704874
|
Thanks for the clarification. I did actually try setting The documentation I'm finding is all very confusing, so I think when I find time again I'm going to just sniff the protocol stream from Microsoft's client and try to figure out where I could add the extra XML blob in pypsrp. |
When I compare the data exchanged with
it could be for normal shells it is true but maybe for the PowerShell it is not. I can definitely see that PowerShell itself doesn't set the key when the default pssession options are done and it is only present when |
Thanks for investigating further. I'm a little confused because it still creates a user profile directory even with this setting, so perhaps some of the things I've read elsewhere are false or no longer true. At the end of the day, I just want to avoid creating a user profile directory at all, but that may not be possible. |
I'm not sure sorry, it wouldn't be the first time that some of the WSMan settings like |
When logging in to remote systems to run some simple scripts, we're finding the user profile directories are being created (e.g.
c:\users\MyWinRMUser
). This is undesirable in many cases.I ran across the
-NoMachineProfile
option here, which might avoid this:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/new-pssessionoption?view=powershell-7.1
How would we specify that session option with pypsrp? More info in:
https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.remoting.pssessionoption.nomachineprofile?view=powershellsdk-1.1.0
https://www.reddit.com/r/PowerShell/comments/aw57xh/newpssession_without_creating_a_profile/
Thanks!
The text was updated successfully, but these errors were encountered: