Skip to content
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

Add -noprofile flag for windows powershell to avoid permission issues #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Benjamin-Displayr
Copy link

We recently had an issue with this hard drive encryption check on a developers windows machine that was using powershell profiles.

In the main.log we found the following error on this command:

[error] <WindowsSystemQueryService>: . : File C:\Users\[UserName]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded because 
its content could not be read.
At line:1 char:3
+ . 'C:\Users\[UserName]\Documents\WindowsPowerShell\Microsoft.Power ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

its content could not be read.
At line:1 char:3
+ . 'C:\Users\[UserName]\Documents\WindowsPowerShell\Microsoft.Power ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

    at C:\Users\[UserName]\AppData\Local\Programs\drata-agent\resources\app.asar\dist\main.js:2:1299642
    at ChildProcess.exithandler (node:child_process:422:7)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.onexit (node:internal/child_process:302:5)

As this command is just running a simple query the powershell scripts don't appear necessary so to avoid this issue for others in future this change just adds the no profile flag to stop powershell attempting to load profiles on launch.

Copy link

sonarcloud bot commented May 9, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@mnrdrata
Copy link
Contributor

Thank you. We already have this change scheduled for the next release. I'll leave this open until that release is published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants