Title: Code OK on V5.1 does not run on V7.0.0RC2 · Issue #11782 · PowerShell/PowerShell · GitHub
Open Graph Title: Code OK on V5.1 does not run on V7.0.0RC2 · Issue #11782 · PowerShell/PowerShell
X Title: Code OK on V5.1 does not run on V7.0.0RC2 · Issue #11782 · PowerShell/PowerShell
Description: Name Value ---- ----- PSVersion 7.0.0-rc.2 PSEdition Core GitCommitId 7.0.0-rc.2 OS Microsoft Windows 10.0.18363 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSMan...
Open Graph Description: Name Value ---- ----- PSVersion 7.0.0-rc.2 PSEdition Core GitCommitId 7.0.0-rc.2 OS Microsoft Windows 10.0.18363 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersio...
X Description: Name Value ---- ----- PSVersion 7.0.0-rc.2 PSEdition Core GitCommitId 7.0.0-rc.2 OS Microsoft Windows 10.0.18363 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersio...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11782
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Code OK on V5.1 does not run on V7.0.0RC2","articleBody":"```\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-rc.2\r\nPSEdition Core\r\nGitCommitId 7.0.0-rc.2\r\nOS Microsoft Windows 10.0.18363\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\n\r\nThe code in the attached script runs OK on V5 but generates the following error on V7:\r\n```\r\nMethodInvocationException: S:\\PowerShellScripts\\TestUserIngroup_1.ps1:5\r\nLine |\r\n 5 | … t -Process {$_.GetType().InvokeMember('Name', 'GetProperty', $null, $ …\r\n | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n | Exception calling \"InvokeMember\" with \"5\" argument(s): \"Unknown name. (0x80020006 (DISP_E_UNKNOWNNAME))\"\r\n```\r\n#### The script:\r\n```powershell\r\n$user = $env:USERNAME\r\n$group = 'Users'\r\n$groupObj = [ADSI]\"WinNT://./$group,group\"\r\n$membersObj = @($groupObj.psbase.Invoke('Members'))\r\n$members = ($membersObj | ForEach-Object -Process {$_.GetType().InvokeMember('Name', 'GetProperty', $null, $_, $null)})\r\n\r\nIf ($members -contains $user) \r\n{Write-Host -Object \"$user exists in the group $group\"}\r\nElse \r\n{Write-Host -Object \"$user does not exists in the group $group\"}\r\n```\r\n\r\n[TestUserIngroup_1.zip](https://github.com/PowerShell/PowerShell/files/4160919/TestUserIngroup_1.zip)\r\n","author":{"url":"https://github.com/RG255","@type":"Person","name":"RG255"},"datePublished":"2020-02-05T17:00:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/11782/PowerShell/issues/11782"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:73301892-fd8b-093d-3a13-5592438f867f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E172:4B3DF:1C3014:27669B:6A579F13 |
| html-safe-nonce | c07018272c8d1e3dbc2426581ed02cfbacfaede7314bbd3042835a7a6eabcd79 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTcyOjRCM0RGOjFDMzAxNDoyNzY2OUI6NkE1NzlGMTMiLCJ2aXNpdG9yX2lkIjoiNjgxMzI0MzkyNDk0MzQ0NTc3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 65e7eeb61f064201a051f052bfe6266ff28326466034c53dfa85b6f28333545a |
| hovercard-subject-tag | issue:560505216 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/11782/issue_layout |
| twitter:image | https://opengraph.githubassets.com/08a3031e97ec11e388b3d0a8063979ccaebcaae277e53ee927a0f4c0ffbeae84/PowerShell/PowerShell/issues/11782 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/08a3031e97ec11e388b3d0a8063979ccaebcaae277e53ee927a0f4c0ffbeae84/PowerShell/PowerShell/issues/11782 |
| og:image:alt | Name Value ---- ----- PSVersion 7.0.0-rc.2 PSEdition Core GitCommitId 7.0.0-rc.2 OS Microsoft Windows 10.0.18363 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RG255 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 017a07c29bdd8a37b5907fc9a689338deb7103b5af7f56714193b2700229b3df |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0dd6847d644323df8f8c1368c065f9f630095e3b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width