PowerShell Modules

PS SQLSERVER:\> Import-Module AppController

Import-Module : The specified module ‘AppController‘ was not loaded because no valid module file was found in any

module directory.

At line:1 char:1

+ Import-Module AppController

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo          : ResourceUnavailable: (AppController:String) [Import-Module], FileNotFoundException

+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

我有加模块的时候,遇到以下问题,总结一下。

确认是否启用了权限:

Get-ExecutionPolicy

如果是Restricted

执行:

Set-ExecutionPolicy RemoteSigned

Y

再试Import-Module AppController

还是不成,查看是否有module

PS C:\Windows\system32> $env:PSModulePath

PS C:\Users\******> $env:PSModulePath

C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Ma

nager\bin\psModules\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\

安装的文件目录不当中。好吧。。。我们把它加上去。

#Save the current value in the $p variable.
$p = [Environment]::GetEnvironmentVariable("PSModulePath")

#Add the new path to the $p variable. Begin with a semi-colon separator.
$p += ";C:\Program Files (x86)\MyCompany\Modules\"

PS C:\Users\****> Get-Module -listAvailable

Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

ModuleType Name                                ExportedCommands

---------- ----                                ----------------

Manifest   AppLocker                           {Set-AppLockerPolicy, Get-AppLockerPolicy, Test-AppLockerPolicy, Get-...

Manifest   BitsTransfer                        {Add-BitsFile, Remove-BitsTransfer, Complete-BitsTransfer, Get-BitsTr...

Manifest   CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSes...

Script     ISE                                 {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}

Manifest   Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}

Manifest   Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}

Manifest   Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}

Manifest   Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}

Manifest   Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}

Manifest   Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSM...

Script     PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, E...

Binary     PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}

Manifest   PSWorkflow                          {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}

Manifest   PSWorkflowUtility                   Invoke-AsWorkflow

Manifest   TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-TroubleshootingPack}

Manifest   WebAdministration                   {Start-WebCommitDelay, Stop-WebCommitDelay, Get-WebConfigurationLock,...

Directory: C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin\psModules

ModuleType Name                                ExportedCommands

---------- ----                                ----------------

Binary     virtualmachinemanager               {Get-SCStorageClusterDisk, Get-SCVMHostFibreChannelHba, New-SCVMHostF...

Binary     virtualmachinemanagercore           {Use-SCStopVM, Use-SCShutdownVM, Use-SCSaveStateVM, Use-SCDiscardSave...

Directory: C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules

ModuleType Name                                ExportedCommands

---------- ----                                ----------------

Manifest   SQLASCMDLETS                        {Add-RoleMember, Backup-ASDatabase, Invoke-ASCmd, Invoke-ProcessCube...}

Manifest   SQLPS                               {Backup-SqlDatabase, Add-SqlAvailabilityDatabase, Disable-SqlAlwaysOn...

Directory: C:\Program Files (x86)\Microsoft System Center 2012 R2\App Controller\PowerShell Modules

ModuleType Name                                ExportedCommands

---------- ----                                ----------------

Binary     AppController

已经安装了,但是AppController有了。但是。。。没有Commands.

到AppController安装的路径确认。。。自动安装到下一级目录中了。所以。。。再调整一下。

PS SQLSERVER:\> Import-Module AppController

PS SQLSERVER:\> Get-Module

真的没有问题了。。。:)

时间: 2024-08-21 23:52:42

PowerShell Modules的相关文章

CentOS 7.2 PowerShell下安装Azure Module

目前Linux版本的PowerShell还是Alpha版本,所以很多功能不能使用. 比如通过Powershell命令:install-module AzureRM在线安装Azure的Module.但我们可以通过变通的方式实现对Azure组件的安装: 1. 如前文中所述,安装PowerShell,或者在下载rpm安装包后,用yum安装: yum install ./powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm 2. 安装完成后,创建PowerSh

Powershell管理系列(十七)PowerShell操作之定时删除过时文件

-----提供AD\Exchange\Lync\Sharepoint\CRM\SC\O365等微软产品实施及外包,QQ:185426445.电话18666943750 开篇前,先说点新年感悟,2010开博5年来,前面两年没怎么动手写博客,真正开始写博客的时间是2013年,那时候Exchange server 2013刚出来不久,全新的软件,全新的界面,全新的体验,当然也带来全新的挑战,那就是我们这些追随微软脚步的工程师又得一次跟上巨人的脚步了,从Exchange server 2003,到后面的

Unit Testing PowerShell Code with Pester

Summary: Guest blogger, Dave Wyatt, discusses using Pester to analyze small pieces of Windows PowerShell code. Note   This is a five-part series that includes the following posts: What is Pester and Why Should I Care?Learn about a new test framework

How to install and configure Azure PowerShell

https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/ In this article: How to: Install Azure PowerShell How to: Connect to your subscription How to use the cmdlets: An example Getting Help Additional Resources 11 Comm

AWS Lambda 自动化和 PowerShell

这两天我都在看如何使用Lambda和Python,但是平常更习惯使用PowerShell来管理各种系统.试试看如何在Lambda里面使用PowerShell吧. 首先在本地计算机上需要安装下面三个模块. 安装PowerShell Corehttps://github.com/powershell/powershell 安装 the .NET Core Software Development Kit (SDK)https://www.microsoft.com/net/download 安装 A

离线安装SharePoint 2013必备组件,AppFabric安装错误问题解决

背景:要安装SharePoint的Windows 2012 Server在IDC机房,无法使用产品准备工具在线安装诸多依赖的必备组件 问题:SharePoint 2013的部分必备组件间存在依赖关系,若安装失败只要调整顺序即可,但AppFabric安装错误很难解决 现象: 1.只选择默认功能时安装AppFabric可以成功,但SharePoint安装程序会因组件不完整无法进行下去 2.选择所有功能安装AppFabric会报错误:“由于安装程序MSI返回错误代码1603,因此,AppFabric安

CI MSBuild env 1

ALLUSERSPROFILE=C:\ProgramDataAPPDATA=C:\Users\user_name\AppData\RoamingCLASSPATH=.;C:\Program Files\Java\jdk1.6.0_45\libCommonProgramFiles=C:\Program Files\Common FilesCommonProgramFiles(x86)=C:\Program Files (x86)\Common FilesCommonProgramW6432=C:\

SharePoint 2013 必备组件之 Windows Server AppFabric 安装错误

SharePoint 2013 必备组件之 Windows Server AppFabric 安装错误 1.如下图,在使用SharePoint2013产品准备工具的时候,网上下载安装Windows Server AppFabric的时候,报错,点击完成重启计算机,重新安装依然报错. 2.无奈之下,只有选择手动安装,下载好安装包,双击安装: 安装完成就报错,但是有如下提示,不过相比日志看起来人性化多了. 由于安装程序MSI返回错误代码1603,因此,AppFabric安装失败. 3.经过不懈的百度

如何禁用在使用receiver时,打开多个断开连接回话

How to Disable Workspace Control Reconnect A question on how to disable workspace control reconnect forCitrix Receivers has come up many times. Workspacecontrol for Receiver for Web can be managed by editing web.config for theReceiver for Web site. P