Solved

PowerShell command missing

Posted on 2013-11-11
4
2,874 Views
Last Modified: 2013-11-23
Hi all,

while trying to setup my local sharepoint 2013 on a windows server 2012 box to use app isolation for a high trust app following this guide I get errors.

Context is: running Windows Server 2012, Sharepoint 2013, entering commands in a Sharepoint 2013 Management Shell run as Administrator.

Powershell version:

PS C:\Windows\system32> $PSVERSIONTABLE

Name                           Value
----                           -----
PSVersion                      3.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18051
BuildVersion                   6.2.9200.16628
PSCompatibleVersions           {1.0, 2.0, 3.0}
PSRemotingProtocolVersion      2.2

Open in new window


Problem:
PS C:\Windows\system32> $publicCertPath = "C:\Users\xyz\Desktop\Bsc
LocalhostCertificate.cer"
PS C:\Windows\system32> $certificate = Get-PfxCertificate $publicCertPath
Get-PfxCertificate : The term 'Get-PfxCertificate' is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:16
+ $certificate = Get-PfxCertificate $publicCertPath
+                ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-PfxCertificate:String) [],
   CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Open in new window


My question now: what do I have to do enable PowerShell / Management Shell to accept Get-PfxCertificate? Some special "Add-PSSnapin"?

Best regards,
Bernd-Christoph Schwede
0
Comment
Question by:BerndChristophSchwede
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 44

Assisted Solution

by:Rainer Jeschor
Rainer Jeschor earned 100 total points
ID: 39638463
Hi Bernd-Christoph,

this is somehow strange as Powershell should load its Microsoft.PowerShell.Security module automatically (when used).

What happens if you enter:
Get-Module

Open in new window

and
Get-Module -ListAvailable

Open in new window


Can you see the security module?

HTH
Rainer
0
 

Author Comment

by:BerndChristophSchwede
ID: 39638721
Hi,

thanks for the pointers. Here's the Get-Module-output:

PS C:\Windows\system32> Get-Module
PS C:\Windows\system32> Get-Module -ListAvailable

ModuleType Name                                ExportedCommands
---------- ----                                ----------------
Manifest   DistributedCacheAdministration      {Connect-AFCacheClusterConfig...
Manifest   DistributedCacheConfiguration       {Get-AFCacheCluster, Get-AFCa...


PS C:\Windows\system32>

Open in new window


Looks a bit compact...and yes, I tried "import module ...":

PS C:\Windows\system32> Import-Module "Microsoft.Powershell.Security"
Import-Module : The specified module 'Microsoft.Powershell.Security' was not
loaded because no valid module file was found in any module directory.
At line:1 char:1
+ Import-Module "Microsoft.Powershell.Security"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (Microsoft.Powershell.Secur
   ity:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
   ands.ImportModuleCommand

Open in new window

Looks too empty to my taste...
0
 

Accepted Solution

by:
BerndChristophSchwede earned 0 total points
ID: 39658705
yuck...solution was: the sharepoint administration shell had missing path elements.
In my case, it should have contained C:\Windows\System32\WindowsPowerShell\v1.0\Modules
- but it didn't...

To test for that:
- locate the relevant cmdlet file on your computer (in my case Microsoft.Powershell.Security.psd1 )
- check $env:PSModulePath to contain the path to the "Moduls" folder above the folder containing the cmdlet file.

Case closed. I'll accept RainerJ's hint as it pointed in the right direction at least...thanks!
0
 

Author Closing Comment

by:BerndChristophSchwede
ID: 39671163
As stated in my comment, RainerJ's comment was pointing deeper to the real problem. Yet the complete solution was still around some more corners...
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question