4719

What is the difference in the way I launch powershell console?

I work with Sharepoint and I need Sharepoint snap-in present in my console host. When I run powershell from my Windows start menu, I run command

Add-PSSnapin Microsoft.Sharepoint.Powershell

snap-in is added ok, and everything works well.

Also, everything is ok, when I run cmd.exe, and type powershell.exe to it and press enter. So I think no shortcut parameters are involved in this problem (but I not 100% sure :) ).

But when I launch powershell through some launcher (I've tested Launchy and Enso) and I try to add the same snap-in, it fails with this error message:

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2. At somefile.ps1:7 char:14 + Add-PSSnapin <<<< Microsoft.Sharepoint.Powershell + CategoryInfo : InvalidArgument:(Microsoft.Sharepoint.Powershell:String) [Add-PSSnapin], PSArgumentException + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

What is the difference when I launch powershell with launcher?

I think this is not sharepoint related problem but rather powershell one.

(note: I know about Sharepoint management shell and question is not about it)

Answer1:

No sure 100% but you may have a trouble with PowerShell 32 bits versus PowerShell 64 Bits.

For Example if your SnapIn is 64 bits, it can be only use with PowerShell 64 bits. If Launchy and Enso are 32 bits they starts powerShell 32 bits that look for a 32 bits SnapIn. It's the same thing in the other side.

<strong>From a 64 bits process</strong>, you can force using PowerShell 64 bits using :

c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe

<strong>From a 64 bits process</strong>, you can force using PowerShell 32 bits using :

c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe

<strong>From a 32 bits process</strong>, you can force using PowerShell 64 bits using (Read this):

c:\windows\sysnative\WindowsPowerShell\v1.0\powershell.exe

Recommend

  • Can I, as a human, view the RSpec rendered views, and if, so how?
  • Using glGetFloatv to retrieve the modelview matrix in pyglet
  • Home screen shortcut to activity
  • Getting rollback in creating shortcuts on installation of node js in windows 7
  • APK 0 (zero) Device compatibility
  • MapView: Could not find class A referenced from method B
  • Linux java wrapper and installer
  • AWS SES Production Access setup with Meteor
  • Singular Value Decomposition Implementation
  • Which JQuery document.ready is better? [duplicate]
  • Add the % on tab when working with HAML on vim
  • Intellij Idea Terminal shortcut not working
  • how to automatically enter password when using ssh?
  • Android - Call default browser with and redirect to a designated url
  • Refresh other frame, from another frame. Jquery
  • Full 8 bit adder, illogical output
  • phpmailer - How to verify a sent email arrived at its destination
  • Persistent stty Settings?
  • button in popup.html not working
  • Visual studio 2015 keystroke with mouse button
  • Python adding lots of things to PATH. How do I stop?
  • Segmentation Fault on MySQL2 / Ruby 1.9.3 / Rails 3.2
  • (Tcl/Expect) clear screen after exit
  • Scanner nextInt() and hasNextInt() problems
  • C#: Import/Export Settings into/from a File
  • jQuery: How to AJAXify WordPress Search?
  • Trying to get the char code of ENTER key
  • Ionic 2 storage is not cleaning up on uninstall - Only for signed APK
  • Atlas images wrong size on iPad iOS 9
  • Why value captured by reference in lambda is broken? [duplicate]
  • NetLogo BehaviorSpace - Measure runs using reporters
  • Spring security and special characters
  • script to move all files from one location to another location
  • Join two tables and save into third-sql
  • JSON with duplicate key names losing information when parsed
  • How to model a transition system with SPIN
  • ORA-29908: missing primary invocation for ancillary operator
  • ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#
  • C# - Getting references of reference
  • Converting MP3 duration time