René's URL Explorer Experiment


Title: [Regression] Can't import Security module when calling PowerShell from Python · Issue #18681 · PowerShell/PowerShell · GitHub

Open Graph Title: [Regression] Can't import Security module when calling PowerShell from Python · Issue #18681 · PowerShell/PowerShell

X Title: [Regression] Can't import Security module when calling PowerShell from Python · Issue #18681 · PowerShell/PowerShell

Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...

Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...

X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/18681

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Regression] Can't import Security module when calling PowerShell from Python","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nI have a python script that runs a .ps1 file which includes commands from the Microsoft.PowerShell.Security module. Starting with 7.3.0, these commands fail to import during script execution. This can be reproduced from a PowerShell window:\r\n\r\n`python -c \"import subprocess; subprocess.Popen('powershell -command Get-ExecutionPolicy')\"`\r\n\r\nOR\r\n\r\n`python -c \"import subprocess; subprocess.Popen('powershell -command Import-Module Microsoft.PowerShell.Security')\"`\r\n\r\n### Expected behavior\r\n\r\n```console\r\nPS C:\\> python -c \"import subprocess; subprocess.Popen('powershell -command Get-ExecutionPolicy')\"\r\nPS C:\\> Restricted\r\nPS C:\\> python -c \"import subprocess; subprocess.Popen('powershell -command Import-Module Microsoft.PowerShell.Security')\"\r\nPS C:\\>\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\nPS C:\\> python -c \"import subprocess; subprocess.Popen('powershell -command Get-ExecutionPolicy')\"\r\nPS C:\\> Get-ExecutionPolicy : The 'Get-ExecutionPolicy' command was found in the module 'Microsoft.PowerShell.Security', but the module could not be loaded. For more\r\ninformation, run 'Import-Module Microsoft.PowerShell.Security'.\r\nAt line:1 char:1\r\n+ Get-ExecutionPolicy\r\n+ ~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : ObjectNotFound: (Get-ExecutionPolicy:String) [], CommandNotFoundException\r\n    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule\r\n\r\n\r\nPS C:\\> python -c \"import subprocess; subprocess.Popen('powershell -command Import-Module Microsoft.PowerShell.Security')\"\r\nPS C:\\> Import-Module : The following error occurred while loading the extended type data file: Error in TypeData \"System.Security.AccessControl.ObjectSecurity\": The\r\nmember AuditToString is already present.\r\nError in TypeData \"System.Security.AccessControl.ObjectSecurity\": The member AccessToString is already present.\r\nError in TypeData \"System.Security.AccessControl.ObjectSecurity\": The member Sddl is already present.\r\nError in TypeData \"System.Security.AccessControl.ObjectSecurity\": The member Access is already present.\r\nError in TypeData \"System.Security.AccessControl.ObjectSecurity\": The member Group is already present.\r\nError in TypeData \"System.Security.AccessControl.ObjectSecurity\": The member Owner is already present.\r\nError in TypeData \"System.Security.AccessControl.ObjectSecurity\": The member Path is already present.\r\nAt line:1 char:1\r\n+ Import-Module Microsoft.PowerShell.Security\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException\r\n    + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand\r\n```\r\n\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nPS> $PSVersionTable\r\n\r\nName                           Value\r\n----                           -----\r\nPSVersion                      7.3.0\r\nPSEdition                      Core\r\nGitCommitId                    7.3.0\r\nOS                             Microsoft Windows 10.0.22622\r\nPlatform                       Win32NT\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\nWSManStackVersion              3.0\r\n\r\nPS> python --version\r\nPython 3.10.6\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/zurcher","@type":"Person","name":"zurcher"},"datePublished":"2022-11-30T01:17:58Z","url":"https://github.com/PowerShell/PowerShell/issues/18681"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6080d493-9e8d-7b57-c554-8e31ab9209d6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE64:34A55:E1A1E6:1437A0A:6AFDA3FD
html-safe-nonce0f515bdeb0d7ccb772579997a95e3aa26e718d7d52e802a29a2a5a8774fdaf65
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTY0OjM0QTU1OkUxQTFFNjoxNDM3QTBBOjZBRkRBM0ZEIiwidmlzaXRvcl9pZCI6Ijg0NjczNDUxODQ4MDYyNDk0NjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6cfd3a6d4dbc79320fd8c40a32368425f056629acdb557f78cf66893b4f1f9ae
hovercard-subject-tagissue:1468911994
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/18681/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c00f2a0fcc17d08a136fa69fe61ccb54b52e15c60b2b449fbd8327baae01ff0b/PowerShell/PowerShell/issues/18681
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c00f2a0fcc17d08a136fa69fe61ccb54b52e15c60b2b449fbd8327baae01ff0b/PowerShell/PowerShell/issues/18681
og:image:altPrerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamezurcher
hostnamegithub.com
expected-hostnamegithub.com
Nonebc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/18681#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F18681
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F18681
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/18681
Reloadhttps://github.com/PowerShell/PowerShell/issues/18681
Reloadhttps://github.com/PowerShell/PowerShell/issues/18681
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests366 (366)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/18681
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/18681
[Regression] Can't import Security module when calling PowerShell from Pythonhttps://github.com/PowerShell/PowerShell/issues/18681#top
Issue-BugIssue has been identified as a bug in the producthttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Bug%22
Resolution-DuplicateThe issue is a duplicate.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Duplicate%22
https://github.com/zurcher
Christopher Zurcher (zurcher)https://github.com/zurcher
on Nov 30, 2022https://github.com/PowerShell/PowerShell/issues/18681#issue-1468911994
latest released versionhttps://github.com/PowerShell/PowerShell/releases
FAQhttps://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md
Differences between Windows PowerShell 5.1 and PowerShellhttps://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell
Christopher Zurcher (zurcher)https://github.com/zurcher
Needs-TriageThe issue is new and needs to be triaged by a work group.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Needs-Triage%22
on Nov 30, 2022https://github.com/PowerShell/PowerShell/issues/18681#event-7917750065
https://github.com/zurcher
Christopher Zurcher (zurcher)https://github.com/zurcher
on Nov 30, 2022https://github.com/PowerShell/PowerShell/issues/18681#issuecomment-1331526689
this comment from the PowerShell VSCode extension chat,https://gitter.im/PowerShell/vscode-powershell?at=6371fd7a2cb6570240282b05
Microsoft.PowerShell.Security.psd1https://github.com/PowerShell/PowerShell/blob/2051c5f72bf53ec4d049c30c19dd1d69d4d847cc/src/Modules/Windows/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1#L16
#16355https://github.com/PowerShell/PowerShell/pull/16355
https://github.com/jborean93
Jordan Borean (jborean93)https://github.com/jborean93
on Nov 30, 2022https://github.com/PowerShell/PowerShell/issues/18681#issuecomment-1331656103
#18530https://github.com/PowerShell/PowerShell/issues/18530
Steven Bucher (StevenBucher98)https://github.com/StevenBucher98
7.3-Triagehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%227.3-Triage%22
Issue-BugIssue has been identified as a bug in the producthttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Bug%22
on Dec 5, 2022https://github.com/PowerShell/PowerShell/issues/18681#event-7958507644
https://github.com/SteveL-MSFT
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
on Dec 12, 2022https://github.com/PowerShell/PowerShell/issues/18681#issuecomment-1346914885
#18530https://github.com/PowerShell/PowerShell/issues/18530
#18530 (comment)https://github.com/PowerShell/PowerShell/issues/18530#issuecomment-1325691850
Steve Lee (SteveL-MSFT)https://github.com/SteveL-MSFT
Resolution-DuplicateThe issue is a duplicate.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Duplicate%22
Needs-TriageThe issue is new and needs to be triaged by a work group.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Needs-Triage%22
on Dec 12, 2022https://github.com/PowerShell/PowerShell/issues/18681#event-8016591223
https://github.com/zurcher
Christopher Zurcher (zurcher)https://github.com/zurcher
on Dec 12, 2022https://github.com/PowerShell/PowerShell/issues/18681#issuecomment-1347119054
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Dec 14, 2022https://github.com/PowerShell/PowerShell/issues/18681#event-8041065900
Daniel Han (danielhanchen)https://github.com/danielhanchen
on Aug 1, 2026https://github.com/PowerShell/PowerShell/issues/18681#event-28805614126
Apply the same PSModulePath fix to install.ps1, which has the same ex…https://github.com/unslothai/unsloth/commit/314fead6e92cd2f0c162d6599c7e8fc3d2e9a70e
314feadhttps://github.com/unslothai/unsloth/commit/314fead6e92cd2f0c162d6599c7e8fc3d2e9a70e
studio setup: let Windows PowerShell load its own Security module (#7692https://github.com/unslothai/unsloth/commit/479b46e8a95d24e4cbb1ab3dd167bc4d3053a7e6
#7692https://github.com/unslothai/unsloth/pull/7692
479b46ehttps://github.com/unslothai/unsloth/commit/479b46e8a95d24e4cbb1ab3dd167bc4d3053a7e6
Furkan Çolak (0furkancolak)https://github.com/0furkancolak
on Sep 5, 2026https://github.com/PowerShell/PowerShell/issues/18681#event-30612634890
fix: take PowerShell calls out of the shared module-analysis cachehttps://github.com/0furkancolak/wtm/commit/090b46b86929cc2c13a0160efeb3bfc1edede363
090b46bhttps://github.com/0furkancolak/wtm/commit/090b46b86929cc2c13a0160efeb3bfc1edede363
Misasagi (Misasag)https://github.com/Misasag
on Sep 26, 2026https://github.com/PowerShell/PowerShell/issues/18681#event-31910989152
Release: fix the Results runtime signature check on GitHub Actionshttps://github.com/Misasag/poiesis/commit/73b5158a9a9d078742e8d928f7a0a775bf906cee
73b5158https://github.com/Misasag/poiesis/commit/73b5158a9a9d078742e8d928f7a0a775bf906cee
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/18681
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/18681
Issue-BugIssue has been identified as a bug in the producthttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Bug%22
Resolution-DuplicateThe issue is a duplicate.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Duplicate%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.