Solved

PowerShell command missing

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Recently, I was assigned the task of performing a hardware refresh in the datacenter. The previous Windows 2008 systems were connected to the SAN via fiber channel HBA’s and among other thing, had PowerPath installed in order to provide sufficient f…
The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
In this Micro Tutorial viewers will learn how to use Windows Server Backup to create full image of their system. Tutorial shows how to install Windows Server Backup Feature on Windows 2012R2 and how to configure scheduled Bare Metal Recovery backup.…
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…

762 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