PowerShell / WindowsCompatibility

Module that allows Windows PowerShell Modules to be used from PSCore6
Other
137 stars 33 forks source link

How can I check if I have installed this module successfully? #46

Closed chucklu closed 5 years ago

chucklu commented 5 years ago

related to this issue https://github.com/PowerShell/PowerShell/issues/7811#issuecomment-424589846 I think I have install this module successfully according this issue https://github.com/PowerShell/WindowsCompatibility/issues/45 However, I can't sue New-EventLog after I installed this module.

When I check the module by Get-Module, there is no module named as WindowsCompatibility. And the module path for Microsoft.PowerShell.Management is C:\program files\powershell\6\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1, is this correct?

~\Desktop> New-EventLog -Source "SupperSocketService" -LogName "TestLog" -MessageResourceFile "C:\Test\TestApp.dll"
New-EventLog : The 'New-EventLog' command was found in the module 'Microsoft.PowerShell.Management', but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Management'.
At line:1 char:1
+ New-EventLog -Source "SupperSocketService" -LogName "TestLog" -Messag ...
+ ~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (New-EventLog:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

~\Desktop> Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.0        build                               {Clear-PSRepo, Compress-TestContent, Convert-TxtResourceToXml, ConvertFrom-PesterLog...}
Script     0.0        chuck                               Reset-FolderTime
Manifest   6.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty...}
Manifest   6.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     1.1.7.2    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}
Script     1.0.0.0    posh-git                            {Add-PoshGitToProfile, Expand-GitCommand, Format-GitBranchName, Get-GitBranchStatusColor...}
Script     1.6.7      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}
Script     2.0.0      PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler...}

~\Desktop> (Get-Module Microsoft.PowerShell.Management).Path
C:\program files\powershell\6\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1
chucklu commented 5 years ago

@SteveL-MSFT any idea?

SteveL-MSFT commented 5 years ago

@BrucePay can you help out?

chucklu commented 5 years ago

@SteveL-MSFT After checking the quick start document. https://github.com/PowerShell/WindowsCompatibility/blob/master/docs/QuickStart.md I find I must invoke the command Import-WinModule Microsoft.PowerShell.Management before I use the New-EventLog. I will add this command to $PROFILE