CentOS7上のPowerShell Coreで使えるコマンドレット群

Facebook にシェア
[`yahoo` not found]
[`livedoor` not found]
[`friendfeed` not found]

CentOS7上で使えるPowerShell Coreでメールを送ろうとした。

スクリプトは「PowerShellを使って日本語メールを送信する方法(v2.0も対応する版)」で使ったものを使用・・・

しかし、Send-MailMessageが存在せず、メール送信に失敗した。

PS /root> Send-MailMessage
Send-MailMessage : The term 'Send-MailMessage' is not recognized as the name of
 a cmdlet, function, script file, or operable program. Check the spelling of th
e name, or if a path was included, verify that the path is correct and try agai
n.
At line:1 char:1
+ Send-MailMessage
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Send-MailMessage:String) [], Co
   mmandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS /root>

どうやら、使えないコマンドレットがそこそこあるようなんだけど、具体的に何なら使えるのかを書いてあるところを見つけられなかった。

しかし、「Get-Module」で取得できるモジュール情報の「ExportedCommands」には、そのモジュールで提供されているコマンドレット/関数一覧がある。
そこで、PowerShell Core環境で用意されているPowerShellでは、どのようなコマンドレットが使えるのか、リストアップしてみた。

PS /root> Get-Module -ListAvailable | % { $_.ExportedCommands.Values } | Sort-Object Name

CommandType     Name                                               Version    S
                                                                              o
                                                                              u
                                                                              r
                                                                              c
                                                                              e
-----------     ----                                               -------    -
Cmdlet          Add-Content                                        3.1.0.0    M
Cmdlet          Add-Member                                         3.1.0.0    M
Function        Add-NodeKeys                                       0.0        P
Cmdlet          Add-Type                                           3.1.0.0    M
Function        AddDscResourceProperty                             0.0        P
Function        AddDscResourcePropertyFromMetadata                 0.0        P
Function        AfterAll                                           3.3.9      P
Function        AfterEach                                          3.3.9      P
Function        Assert-MockCalled                                  3.3.9      P
Function        Assert-VerifiableMocks                             3.3.9      P
Function        BeforeAll                                          3.3.9      P
Function        BeforeEach                                         3.3.9      P
Function        CheckResourceFound                                 0.0        P
Cmdlet          Clear-Content                                      3.1.0.0    M
Cmdlet          Clear-Item                                         3.1.0.0    M
Cmdlet          Clear-ItemProperty                                 3.1.0.0    M
Cmdlet          Clear-Variable                                     3.1.0.0    M
Cmdlet          Compare-Object                                     3.1.0.0    M
Function        Compress-Archive                                   1.0.1.0    M
Function        Configuration                                      0.0        P
Function        Context                                            3.3.9      P
Cmdlet          Convert-Path                                       3.1.0.0    M
Cmdlet          ConvertFrom-Csv                                    3.1.0.0    M
Cmdlet          ConvertFrom-Json                                   3.1.0.0    M
Cmdlet          ConvertFrom-SecureString                           3.0.0.0    M
Cmdlet          ConvertFrom-StringData                             3.1.0.0    M
Cmdlet          ConvertTo-Csv                                      3.1.0.0    M
Cmdlet          ConvertTo-Html                                     3.1.0.0    M
Cmdlet          ConvertTo-Json                                     3.1.0.0    M
Function        ConvertTo-MOFInstance                              0.0        P
Cmdlet          ConvertTo-SecureString                             3.0.0.0    M
Cmdlet          ConvertTo-Xml                                      3.1.0.0    M
Cmdlet          Copy-Item                                          3.1.0.0    M
Cmdlet          Copy-ItemProperty                                  3.1.0.0    M
Cmdlet          Debug-Process                                      3.1.0.0    M
Cmdlet          Debug-Runspace                                     3.1.0.0    M
Function        Describe                                           3.3.9      P
Cmdlet          Disable-PSBreakpoint                               3.1.0.0    M
Cmdlet          Disable-RunspaceDebug                              3.1.0.0    M
Cmdlet          Enable-PSBreakpoint                                3.1.0.0    M
Cmdlet          Enable-RunspaceDebug                               3.1.0.0    M
Function        Expand-Archive                                     1.0.1.0    M
Cmdlet          Export-Alias                                       3.1.0.0    M
Cmdlet          Export-Clixml                                      3.1.0.0    M
Cmdlet          Export-Csv                                         3.1.0.0    M
Cmdlet          Export-FormatData                                  3.1.0.0    M
Cmdlet          Export-PSSession                                   3.1.0.0    M
Alias           fhx ->                                             3.1.0.0    M
Alias           fimo ->                                            1.1.2.0    P
Function        Find-Command                                       1.1.2.0    P
Function        Find-DscResource                                   1.1.2.0    P
Function        Find-Module                                        1.1.2.0    P
Cmdlet          Find-Package                                       1.1.2.0    P
Cmdlet          Find-PackageProvider                               1.1.2.0    P
Function        Find-RoleCapability                                1.1.2.0    P
Function        Find-Script                                        1.1.2.0    P
Cmdlet          Format-Custom                                      3.1.0.0    M
Function        Format-Hex                                         3.1.0.0    M
Cmdlet          Format-List                                        3.1.0.0    M
Cmdlet          Format-Table                                       3.1.0.0    M
Cmdlet          Format-Wide                                        3.1.0.0    M
Alias           gcfg ->                                            0.0        P
Alias           gcfgs ->                                           0.0        P
Function        Generate-VersionInfo                               0.0        P
Cmdlet          Get-Alias                                          3.1.0.0    M
Cmdlet          Get-ChildItem                                      3.1.0.0    M
Function        Get-CompatibleVersionAddtionaPropertiesStr         0.0        P
Function        Get-ComplexResourceQualifier                       0.0        P
Function        Get-ConfigurationErrorCount                        0.0        P
Cmdlet          Get-Content                                        3.1.0.0    M
Cmdlet          Get-Credential                                     3.0.0.0    M
Cmdlet          Get-Culture                                        3.1.0.0    M
Cmdlet          Get-Date                                           3.1.0.0    M
Function        Get-DscResource                                    0.0        P
Function        Get-DSCResourceModules                             0.0        P
Function        Get-EncryptedPassword                              0.0        P
Cmdlet          Get-Event                                          3.1.0.0    M
Cmdlet          Get-EventSubscriber                                3.1.0.0    M
Cmdlet          Get-ExecutionPolicy                                3.0.0.0    M
Cmdlet          Get-FileHash                                       3.1.0.0    M
Cmdlet          Get-FormatData                                     3.1.0.0    M
Cmdlet          Get-Host                                           3.1.0.0    M
Function        Get-InnerMostErrorRecord                           0.0        P
Function        Get-InstalledModule                                1.1.2.0    P
Function        Get-InstalledScript                                1.1.2.0    P
Cmdlet          Get-Item                                           3.1.0.0    M
Cmdlet          Get-ItemProperty                                   3.1.0.0    M
Cmdlet          Get-ItemPropertyValue                              3.1.0.0    M
Cmdlet          Get-Location                                       3.1.0.0    M
Cmdlet          Get-Member                                         3.1.0.0    M
Function        Get-MockDynamicParameters                          3.3.9      P
Function        Get-MofInstanceName                                0.0        P
Function        Get-MofInstanceText                                0.0        P
Cmdlet          Get-Package                                        1.1.2.0    P
Cmdlet          Get-PackageProvider                                1.1.2.0    P
Cmdlet          Get-PackageSource                                  1.1.2.0    P
Function        Get-PositionInfo                                   0.0        P
Cmdlet          Get-Process                                        3.1.0.0    M
Cmdlet          Get-PSBreakpoint                                   3.1.0.0    M
Cmdlet          Get-PSCallStack                                    3.1.0.0    M
Function        Get-PSCurrentConfigurationNode                     0.0        P
Function        Get-PSDefaultConfigurationDocument                 0.0        P
Cmdlet          Get-PSDrive                                        3.1.0.0    M
Function        Get-PSMetaConfigDocumentInstVersionInfo            0.0        P
Function        Get-PSMetaConfigurationProcessed                   0.0        P
Cmdlet          Get-PSProvider                                     3.1.0.0    M
Cmdlet          Get-PSReadlineKeyHandler                           1.2        P
Cmdlet          Get-PSReadlineOption                               1.2        P
Function        Get-PSRepository                                   1.1.2.0    P
Function        Get-PSTopConfigurationName                         0.0        P
Function        Get-PublicKeyFromFile                              0.0        P
Function        Get-PublicKeyFromStore                             0.0        P
Cmdlet          Get-Random                                         3.1.0.0    M
Cmdlet          Get-Runspace                                       3.1.0.0    M
Cmdlet          Get-RunspaceDebug                                  3.1.0.0    M
Function        Get-TestDriveItem                                  3.3.9      P
Cmdlet          Get-TraceSource                                    3.1.0.0    M
Cmdlet          Get-TypeData                                       3.1.0.0    M
Cmdlet          Get-UICulture                                      3.1.0.0    M
Cmdlet          Get-Unique                                         3.1.0.0    M
Cmdlet          Get-Uptime                                         3.1.0.0    M
Cmdlet          Get-Variable                                       3.1.0.0    M
Cmdlet          Get-Verb                                           3.1.0.0    M
Function        GetCompositeResource                               0.0        P
Function        GetImplementingModulePath                          0.0        P
Function        GetModule                                          0.0        P
Function        GetPatterns                                        0.0        P
Function        GetResourceFromKeyword                             0.0        P
Function        GetSyntax                                          0.0        P
Alias           glcm ->                                            0.0        P
Cmdlet          Group-Object                                       3.1.0.0    M
Function        HookGetViewAutoCompleter                           1.21       P
Cmdlet          Import-Alias                                       3.1.0.0    M
Cmdlet          Import-Clixml                                      3.1.0.0    M
Cmdlet          Import-Csv                                         3.1.0.0    M
Cmdlet          Import-LocalizedData                               3.1.0.0    M
Cmdlet          Import-PackageProvider                             1.1.2.0    P
Function        Import-PowerShellDataFile                          3.1.0.0    M
Cmdlet          Import-PSSession                                   3.1.0.0    M
Function        ImportCimAndScriptKeywordsFromModule               0.0        P
Function        ImportClassResourcesFromModule                     0.0        P
Function        In                                                 3.3.9      P
Function        Initialize-ConfigurationRuntimeState               0.0        P
Alias           inmo ->                                            1.1.2.0    P
Function        InModuleScope                                      3.3.9      P
Function        Install-Module                                     1.1.2.0    P
Cmdlet          Install-Package                                    1.1.2.0    P
Cmdlet          Install-PackageProvider                            1.1.2.0    P
Function        Install-Script                                     1.1.2.0    P
Cmdlet          Invoke-Expression                                  3.1.0.0    M
Cmdlet          Invoke-Item                                        3.1.0.0    M
Function        Invoke-Mock                                        3.3.9      P
Function        Invoke-Pester                                      3.3.9      P
Cmdlet          Invoke-RestMethod                                  3.1.0.0    M
Cmdlet          Invoke-WebRequest                                  3.1.0.0    M
Function        IsHiddenResource                                   0.0        P
Function        IsPatternMatched                                   0.0        P
Function        It                                                 3.3.9      P
Cmdlet          Join-Path                                          3.1.0.0    M
Cmdlet          Measure-Command                                    3.1.0.0    M
Cmdlet          Measure-Object                                     3.1.0.0    M
Function        Mock                                               3.3.9      P
Cmdlet          Move-Item                                          3.1.0.0    M
Cmdlet          Move-ItemProperty                                  3.1.0.0    M
Cmdlet          New-Alias                                          3.1.0.0    M
Function        New-DscChecksum                                    0.0        P
Cmdlet          New-Event                                          3.1.0.0    M
Function        New-Fixture                                        3.3.9      P
Cmdlet          New-Guid                                           3.1.0.0    M
Cmdlet          New-Item                                           3.1.0.0    M
Cmdlet          New-ItemProperty                                   3.1.0.0    M
Cmdlet          New-Object                                         3.1.0.0    M
Cmdlet          New-PSDrive                                        3.1.0.0    M
Function        New-ScriptFileInfo                                 1.1.2.0    P
Cmdlet          New-TemporaryFile                                  3.1.0.0    M
Cmdlet          New-TimeSpan                                       3.1.0.0    M
Cmdlet          New-Variable                                       3.1.0.0    M
Function        Node                                               0.0        P
Cmdlet          Out-File                                           3.1.0.0    M
Cmdlet          Out-String                                         3.1.0.0    M
Alias           pbcfg ->                                           0.0        P
Cmdlet          Pop-Location                                       3.1.0.0    M
Function        PSConsoleHostReadline                              1.2        P
Function        Publish-Module                                     1.1.2.0    P
Function        Publish-Script                                     1.1.2.0    P
Alias           pumo ->                                            1.1.2.0    P
Cmdlet          Push-Location                                      3.1.0.0    M
Cmdlet          Read-Host                                          3.1.0.0    M
Function        ReadEnvironmentFile                                0.0        P
Cmdlet          Register-EngineEvent                               3.1.0.0    M
Cmdlet          Register-ObjectEvent                               3.1.0.0    M
Cmdlet          Register-PackageSource                             1.1.2.0    P
Function        Register-PSRepository                              1.1.2.0    P
Cmdlet          Remove-Event                                       3.1.0.0    M
Cmdlet          Remove-Item                                        3.1.0.0    M
Cmdlet          Remove-ItemProperty                                3.1.0.0    M
Cmdlet          Remove-PSBreakpoint                                3.1.0.0    M
Cmdlet          Remove-PSDrive                                     3.1.0.0    M
Cmdlet          Remove-PSReadlineKeyHandler                        1.2        P
Cmdlet          Remove-TypeData                                    3.1.0.0    M
Cmdlet          Remove-Variable                                    3.1.0.0    M
Cmdlet          Rename-Item                                        3.1.0.0    M
Cmdlet          Rename-ItemProperty                                3.1.0.0    M
Cmdlet          Resolve-Path                                       3.1.0.0    M
Alias           rtcfg ->                                           0.0        P
Alias           sacfg ->                                           0.0        P
Function        Save-Module                                        1.1.2.0    P
Cmdlet          Save-Package                                       1.1.2.0    P
Function        Save-Script                                        1.1.2.0    P
Cmdlet          Select-Object                                      3.1.0.0    M
Cmdlet          Select-String                                      3.1.0.0    M
Cmdlet          Select-Xml                                         3.1.0.0    M
Cmdlet          Set-Alias                                          3.1.0.0    M
Cmdlet          Set-Content                                        3.1.0.0    M
Cmdlet          Set-Date                                           3.1.0.0    M
Function        Set-DynamicParameterVariables                      3.3.9      P
Cmdlet          Set-ExecutionPolicy                                3.0.0.0    M
Cmdlet          Set-Item                                           3.1.0.0    M
Cmdlet          Set-ItemProperty                                   3.1.0.0    M
Cmdlet          Set-Location                                       3.1.0.0    M
Function        Set-NodeExclusiveResources                         0.0        P
Function        Set-NodeManager                                    0.0        P
Function        Set-NodeResources                                  0.0        P
Function        Set-NodeResourceSource                             0.0        P
Cmdlet          Set-PackageSource                                  1.1.2.0    P
Cmdlet          Set-PSBreakpoint                                   3.1.0.0    M
Function        Set-PSCurrentConfigurationNode                     0.0        P
Function        Set-PSDefaultConfigurationDocument                 0.0        P
Function        Set-PSMetaConfigDocInsProcessedBeforeMeta          0.0        P
Function        Set-PSMetaConfigVersionInfoV2                      0.0        P
Cmdlet          Set-PSReadlineKeyHandler                           1.2        P
Cmdlet          Set-PSReadlineOption                               1.2        P
Function        Set-PSRepository                                   1.1.2.0    P
Function        Set-PSTopConfigurationName                         0.0        P
Cmdlet          Set-TraceSource                                    3.1.0.0    M
Cmdlet          Set-Variable                                       3.1.0.0    M
Function        Setup                                              3.3.9      P
Function        Should                                             3.3.9      P
Alias           slcm ->                                            0.0        P
Cmdlet          Sort-Object                                        3.1.0.0    M
Cmdlet          Split-Path                                         3.1.0.0    M
Cmdlet          Start-Process                                      3.1.0.0    M
Cmdlet          Start-Sleep                                        3.1.0.0    M
Cmdlet          Start-Transcript                                   3.0.0.0    M
Cmdlet          Stop-Process                                       3.1.0.0    M
Cmdlet          Stop-Transcript                                    3.0.0.0    M
Function        StrongConnect                                      0.0        P
Alias           tcfg ->                                            0.0        P
Cmdlet          Tee-Object                                         3.1.0.0    M
Function        Test-ConflictingResources                          0.0        P
Function        Test-ModuleReloadRequired                          0.0        P
Function        Test-MofInstanceText                               0.0        P
Function        Test-NodeManager                                   0.0        P
Function        Test-NodeResources                                 0.0        P
Function        Test-NodeResourceSource                            0.0        P
Cmdlet          Test-Path                                          3.1.0.0    M
Function        Test-ScriptFileInfo                                1.1.2.0    P
Function        ThrowError                                         0.0        P
Cmdlet          Trace-Command                                      3.1.0.0    M
Alias           ulcm ->                                            0.0        P
Function        Uninstall-Module                                   1.1.2.0    P
Cmdlet          Uninstall-Package                                  1.1.2.0    P
Function        Uninstall-Script                                   1.1.2.0    P
Cmdlet          Unregister-Event                                   3.1.0.0    M
Cmdlet          Unregister-PackageSource                           1.1.2.0    P
Function        Unregister-PSRepository                            1.1.2.0    P
Alias           upcfg ->                                           0.0        P
Function        Update-ConfigurationDocumentRef                    0.0        P
Function        Update-ConfigurationErrorCount                     0.0        P
Function        Update-DependsOn                                   0.0        P
Cmdlet          Update-FormatData                                  3.1.0.0    M
Function        Update-LocalConfigManager                          0.0        P
Function        Update-Module                                      1.1.2.0    P
Function        Update-ModuleManifest                              1.1.2.0    P
Function        Update-ModuleVersion                               0.0        P
Function        Update-Script                                      1.1.2.0    P
Function        Update-ScriptFileInfo                              1.1.2.0    P
Cmdlet          Update-TypeData                                    3.1.0.0    M
Alias           upmo ->                                            1.1.2.0    P
Function        ValidateNoCircleInNodeResources                    0.0        P
Function        ValidateNodeExclusiveResources                     0.0        P
Function        ValidateNodeManager                                0.0        P
Function        ValidateNodeResources                              0.0        P
Function        ValidateNodeResourceSource                         0.0        P
Function        ValidateNoNameNodeResources                        0.0        P
Function        ValidateUpdate-ConfigurationData                   0.0        P
Cmdlet          Wait-Debugger                                      3.1.0.0    M
Cmdlet          Wait-Event                                         3.1.0.0    M
Cmdlet          Wait-Process                                       3.1.0.0    M
Cmdlet          Write-Debug                                        3.1.0.0    M
Cmdlet          Write-Error                                        3.1.0.0    M
Cmdlet          Write-Host                                         3.1.0.0    M
Cmdlet          Write-Information                                  3.1.0.0    M
Function        Write-Log                                          0.0        P
Function        Write-MetaConfigFile                               0.0        P
Function        Write-NodeMOFFile                                  0.0        P
Cmdlet          Write-Output                                       3.1.0.0    M
Cmdlet          Write-Progress                                     3.1.0.0    M
Cmdlet          Write-Verbose                                      3.1.0.0    M
Cmdlet          Write-Warning                                      3.1.0.0    M
Function        WriteFile                                          0.0        P


PS /root>

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>