Solved

PowerShell command missing

Posted on 2013-11-11
4
2,142 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
  • 3
4 Comments
 
LVL 44

Assisted Solution

by:Rainer Jeschor
Rainer Jeschor earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
OfficeMate Freezes on login or does not load after login credentials are input.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now