Solved

PowerShell command missing

Posted on 2013-11-11
4
2,345 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

832 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