# Скрипт: test.ps1 # Версия: 1.0.0 $FMODULES = @() $FMODULE = '' # Символ или текст $FMODULES = ,$FMODULE * 1000 wh "Количество FMODULES : $($FMODULES.Length)" $FMODULES = ,$FMODULE * 1000; wh "Количество FMODULES : $($FMODULES.Length)" $FMODULES = @('console','HermesConsoleUI','ConsoleFX','','','','','','','') wh "Количество FMODULES : $($FMODULES.Length)" $FMODULES = $FMODULES | Where-Object { $_.Trim().Length -ne 0 } wh "Количество FMODULES : $($FMODULES.Length)" # MinimumVersion Credential AllowClobber AcceptLicense Verbose InformationAction InformationVariable # MaximumVersion Scope SkipPublisherCheck PassThru Debug ProgressAction OutVariable # RequiredVersion Proxy Force WhatIf ErrorAction ErrorVariable OutBuffer # Repository ProxyCredential AllowPrerelease Confirm WarningAction WarningVariable PipelineVariable # Import-Module -Name Microsoft.PowerShell.Archive -PassThru | Get-Member # ************************************************************************************************************************************************************************ # AsCustomObject Method psobject AsCustomObject() # Clone Method psmoduleinfo Clone() # Equals Method bool Equals(System.Object obj) # GetExportedTypeDefinitions Method System.Collections.ObjectModel.ReadOnlyDictionary[string,System.Management.Automation.Language.TypeDefinitionAst] GetExportedTypeDefinitions() # GetHashCode Method int GetHashCode() # GetType Method type GetType() # GetVariableFromCallersModule Method psvariable GetVariableFromCallersModule(string variableName) # Invoke Method System.Object Invoke(scriptblock sb, Params System.Object[] args) # NewBoundScriptBlock Method scriptblock NewBoundScriptBlock(scriptblock scriptBlockToBind) # ToString Method string ToString() # AccessMode Property System.Management.Automation.ModuleAccessMode AccessMode {get;set;} # Author Property string Author {get;} # ClrVersion Property version ClrVersion {get;} # CompanyName Property string CompanyName {get;} # CompatiblePSEditions Property System.Collections.Generic.IEnumerable[string] CompatiblePSEditions {get;} # Copyright Property string Copyright {get;} # Definition Property string Definition {get;} # Description Property string Description {get;set;} # DotNetFrameworkVersion Property version DotNetFrameworkVersion {get;} # ExperimentalFeatures Property System.Collections.Generic.IEnumerable[ExperimentalFeature] ExperimentalFeatures {get;} # ExportedAliases Property System.Collections.Generic.Dictionary[string,System.Management.Automation.AliasInfo] ExportedAliases {get;} # ExportedCmdlets Property System.Collections.Generic.Dictionary[string,System.Management.Automation.CmdletInfo] ExportedCmdlets {get;} # ExportedCommands Property System.Collections.Generic.Dictionary[string,System.Management.Automation.CommandInfo] ExportedCommands {get;} # ExportedDscResources Property System.Collections.ObjectModel.ReadOnlyCollection[string] ExportedDscResources {get;} # ExportedFormatFiles Property System.Collections.ObjectModel.ReadOnlyCollection[string] ExportedFormatFiles {get;} # ExportedFunctions Property System.Collections.Generic.Dictionary[string,System.Management.Automation.FunctionInfo] ExportedFunctions {get;} # ExportedTypeFiles Property System.Collections.ObjectModel.ReadOnlyCollection[string] ExportedTypeFiles {get;} # ExportedVariables Property System.Collections.Generic.Dictionary[string,psvariable] ExportedVariables {get;} # FileList Property System.Collections.Generic.IEnumerable[string] FileList {get;} # Guid Property guid Guid {get;} # HelpInfoUri Property string HelpInfoUri {get;} # IconUri Property uri IconUri {get;} # ImplementingAssembly Property System.Reflection.Assembly ImplementingAssembly {get;} # LicenseUri Property uri LicenseUri {get;} # LogPipelineExecutionDetails Property bool LogPipelineExecutionDetails {get;set;} # ModuleBase Property string ModuleBase {get;} # ModuleList Property System.Collections.Generic.IEnumerable[System.Object] ModuleList {get;} # ModuleType Property System.Management.Automation.ModuleType ModuleType {get;} # Name Property string Name {get;} # NestedModules Property System.Collections.ObjectModel.ReadOnlyCollection[psmoduleinfo] NestedModules {get;} # OnRemove Property scriptblock OnRemove {get;set;} # Path Property string Path {get;} # PowerShellHostName Property string PowerShellHostName {get;} # PowerShellHostVersion Property version PowerShellHostVersion {get;} # PowerShellVersion Property version PowerShellVersion {get;} # Prefix Property string Prefix {get;} # PrivateData Property System.Object PrivateData {get;set;} # ProcessorArchitecture Property System.Reflection.ProcessorArchitecture ProcessorArchitecture {get;} # ProjectUri Property uri ProjectUri {get;} # ReleaseNotes Property string ReleaseNotes {get;} # RepositorySourceLocation Property uri RepositorySourceLocation {get;} # RequiredAssemblies Property System.Collections.Generic.IEnumerable[string] RequiredAssemblies {get;} # RequiredModules Property System.Collections.ObjectModel.ReadOnlyCollection[psmoduleinfo] RequiredModules {get;} # RootModule Property string RootModule {get;} # Scripts Property System.Collections.Generic.IEnumerable[string] Scripts {get;} # SessionState Property System.Management.Automation.SessionState SessionState {get;set;} # Tags Property System.Collections.Generic.IEnumerable[string] Tags {get;} # Version Property version Version {get;} # ************************************************************************************************************************************************************************ # ************************************************************************************************************************************************************************ # (Get-Module -Name Microsoft.PowerShell.Archive).ExportedCommands # Get-Module -Name Microsoft.PowerShell.Archive | Get-Member # Import-Module -Name Microsoft.PowerShell.Archive -PassThru | Get-Member # # ************************************************************************************************************************************************************************ # ************************************************************************************************************************************************************************ $FMODULES = @() $FMODULE = '' # Символ или текст $FMODULES = ,$FMODULE * 1000 wh "Количество FMODULES : $($FMODULES.Length)" $FMODULES = ,$FMODULE * 1000; wh "Количество FMODULES : $($FMODULES.Length)" $FMODULES = @('console','HermesConsoleUI','ConsoleFX','','','','','','','') wh "Количество FMODULES : $($FMODULES.Length)" $FMODULES = $FMODULES | Where-Object { $_.Trim().Length -ne 0 } wh "Количество FMODULES : $($FMODULES.Length)" function Install-MyModule { param( $Names ) cls $FMSG_EMPTY = @" Пустой параметр `$Names Install-MyModule @('Name1','Name2') или `$NAMES = @('Name1','Name2') Install-MyModule `$NAMES "@ if ($Null -eq $Names) { Write-Host "$FMSG_EMPTY" -ForegroundColor Red return } $FMODULES = $Names | Where-Object { $_.Trim().Length -ne 0 } foreach ($M in $FMODULES) { $MNAME = "$($M)" $FMSG = "Модуль : $MNAME" Write-Host "$FMSG" -ForegroundColor Cyan # $FCMD = "Install-Module $MNAME -Force -PassThru -AllowClobber -Verbose" # $FMSG = "Команда : $FCMD" # Write-Host "$FMSG" -ForegroundColor Magenta # iex "$FCMD" # if lasterror ??? # $FCMD = "Import-Module $MNAME -Force -Verbose" # $FMSG = "Команда : $FCMD" # Write-Host "$FMSG" -ForegroundColor Magenta # iex "$FCMD" # if lasterror ??? # $MNAME = "HermesConsoleUI" # 1. Тест установки модуля # К строке обязательно добавляем -ErrorAction Stop $FCMD = "Install-Module $MNAME -Force -PassThru -AllowClobber -Verbose -ErrorAction Stop" $FMSG = "Команда : $FCMD" Write-Host "$FMSG" -ForegroundColor Magenta try { iex "$FCMD" Write-Host "Установка успешно завершена!" -ForegroundColor Green } catch { # Переменная $_ содержит текст ошибки, возникшей внутри iex Write-Host "Ошибка выполнения iex при установке: $_" -ForegroundColor Red return } # 2. Тест импорта модуля $FCMD = "Import-Module $MNAME -Force -Verbose -ErrorAction Stop" $FMSG = "Команда : $FCMD" Write-Host "$FMSG" -ForegroundColor Magenta try { iex "$FCMD" Write-Host "Импорт успешно завершен!" -ForegroundColor Green } catch { Write-Host "Ошибка выполнения iex при импорте: $_" -ForegroundColor Red return } } } Install-MyModule Install-MyModule @('console','HermesConsoleUI','ConsoleFX','','','','','','','') $FMLS = @('console','HermesConsoleUI','ConsoleFX','','','','','','','') $i = 0 $M = $FMLS[$i] # Get-Module -Name $M | Get-Member (Get-Module -Name $M).ExportedCommands $M = $FMLS[$i++] wh "Модуль $M" (Get-Module -Name $M).ExportedCommands $SS = "*" * 200 wh "$SS" wh "" # Get-Module -Name $M | Get-Member $FMLS = @('console','HermesConsoleUI','ConsoleFX','','','','','','','') # Install-MyModule $FMLS foreach ($M in $FMLS) { $MNAME = "$($M)" wh "Модуль : $MNAME" # $FCMD = "Install-Module $MNAME -Force -PassThru -AllowClobber -Verbose" # iex "$FCMD" # wh "$FCMD" # $FCMD = " ========== Команды модуля $MNAME ==========" # $FCMD = "Import-Module $MNAME -Force -PassThru -AllowClobber -Verbose" # iex "$FCMD" # wh "(Get-Module -Name $MNAME).ExportedCommands" FCMD = "Get-Module -Name $MNAME | Get-Member" wh "************************************************" wh "" } $FMLS = @('console','HermesConsoleUI','ConsoleFX','','','','','','','') $FMODULES = $FMLS | Where-Object { $_.Trim().Length -ne 0 } foreach ($M in $FMODULES) { $MNAME = "$($M)" wh "Модуль : $MNAME" $FCMD = "Get-Module -Name $MNAME -ListAvailable" wh "Команда: $FCMD" iex "$FCMD" wh "************************************************" wh "" } AdditionalMetadata Property System.Collections.Generic.Dictionary[string,string] AdditionalMetadata {get;} Author Property string Author {get;set;} CompanyName Property string CompanyName {get;set;} Copyright Property string Copyright {get;set;} Dependencies Property Microsoft.PowerShell.PSResourceGet.UtilClasses.Dependency[] Dependencies {get;set;} Description Property string Description {get;set;} IconUri Property uri IconUri {get;set;} Includes Property Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceIncludes Includes {get;} InstalledDate Property System.Nullable[datetime] InstalledDate {get;set;} InstalledLocation Property string InstalledLocation {get;set;} IsPrerelease Property bool IsPrerelease {get;set;} LicenseUri Property uri LicenseUri {get;set;} Name Property string Name {get;set;} Prerelease Property string Prerelease {get;} ProjectUri Property uri ProjectUri {get;set;} PublishedDate Property System.Nullable[datetime] PublishedDate {get;set;} ReleaseNotes Property string ReleaseNotes {get;set;} Repository Property string Repository {get;set;} RepositorySourceLocation Property string RepositorySourceLocation {get;set;} Tags Property string[] Tags {get;set;} Type Property Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceType Type {get;} UpdatedDate Property System.Nullable[datetime] UpdatedDate {get;} Version Property version Version {get;} Initialize-Localization Initialize-Localization Initialize-UIConfig Initialize-UIConfig Invoke-ConsoleMenu Invoke-ConsoleMenu Invoke-ConsoleSpinner Invoke-ConsoleSpinner New-ConsoleColumn New-ConsoleColumn New-ConsoleLayout New-ConsoleLayout New-ConsoleRow New-ConsoleRow Read-ConsoleChoice Read-ConsoleChoice Read-ConsoleConfirmation Read-ConsoleConfirmation Read-ConsoleInput Read-ConsoleInput Read-ConsoleMultiChoice Read-ConsoleMultiChoice Read-ConsolePassword Read-ConsolePassword Set-ConsoleTheme Set-ConsoleTheme Set-UILocale Set-UILocale Show-ConsoleList Show-ConsoleList Show-ConsoleMenu Show-ConsoleMenu Show-ConsoleNotification Show-ConsoleNotification Show-ConsoleProgress Show-ConsoleProgress Write-ConsoleBox Write-ConsoleBox Write-ConsoleBreadcrumb Write-ConsoleBreadcrumb Write-ConsoleChart Write-ConsoleChart Write-ConsoleDiff Write-ConsoleDiff Write-ConsoleError Write-ConsoleError Write-ConsoleHeader Write-ConsoleHeader Write-ConsoleInfo Write-ConsoleInfo Write-ConsoleLayout Write-ConsoleLayout Write-ConsoleMetadata Write-ConsoleMetadata Write-ConsolePanel Write-ConsolePanel Write-ConsoleProgress Write-ConsoleProgress Write-ConsoleSeparator Write-ConsoleSeparator Write-ConsoleSparkline Write-ConsoleSparkline Write-ConsoleStatus Write-ConsoleStatus Write-ConsoleSubtitle Write-ConsoleSubtitle Write-ConsoleSummary Write-ConsoleSummary Write-ConsoleTable Write-ConsoleTable Write-ConsoleTitle Write-ConsoleTitle Write-ConsoleTree Write-ConsoleTree $c = Get-Content 'L:\Development\009-Self-host\0002-Keenetic\0002-Keenetic-xkeen\0000-gper-peak.sh\cache\translate_cache.json' -Raw | ConvertFrom-Json # $c.PSObject.Properties | Out-GridView -Title "Переведено: $($c.PSObject.Properties).count" $c.PSObject.Properties | Select-Object -First 5 -Property Name,Value | Out-GridView -Title "Переведено: $($c.PSObject.Properties).count"