Add-PSSnapin Microsoft.Crm.PowerShell not installed error - powershell

Trying to script an upgrade for my Dynamics organization following this TechNet blog.
But running into the below error which I understand, but not sure the process to get the PSSnapin onto my system.
PS C:\Program Files\Dynamics SDK\SDK\Bin> Add-PSSnapin Microsoft.Crm.PowerShell
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.Crm.PowerShell' is not installed on this computer.
At line:1 char:1
+ Add-PSSnapin Microsoft.Crm.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Crm.PowerShell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

First of all, sign in with the Administrator account on your Microsoft Dynamics 365 server.
Then in elevated mode Run
Add-PSSnapin Microsoft.Crm.PowerShell
If you have no registered then use the Use PowerShell cmdlets for XRM tooling to connect to Dynamics 365
You can externally also download the same from GITHUB:
Link provided by theMadTechnician
Hope it helps

Related

powershell Microsoft.PowerShell.Utility module could not be loaded

I have this problem in a brand new workstation with Windows 10 installed: on powershell, the 5.1, when I call "Write-Host 'test'" I receive
Write-Host : The 'Write-Host' command was found in the module
'Microsoft.PowerShell.Utility', but the module could not
be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Utility'.
At line:1 char:1
+ Write-Host "test"
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Write-Host:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
And if I try to Import-Module I receive an error.
I installed the powershell 7.2 and in that case I have no problem, but I must use the 5.1 for compatibility reasons.
I already tried to remove/reinstall the powershell windows feature but no way.
Does anyone have a suggestion?
Thx

Importing Azure Rm gives me an error

I have a windows 7 Professional SP1 machine and have installed the windows azure poweshell version 3.7.0 and also have installed the azure rm successfully. But whenever i am trying to import the Azure Rm via the admin login i get the following error
PS C:\Users\swagh> Import-Module AzureRM
Import-Module : File C:\Program Files\WindowsPowerShell\Modules\AzureRM\4.2.1\AzureRM.psm1 cannot b
its operation is blocked by software restriction policies, such as those created by using Group Pol
At line:1 char:1
+ Import-Module AzureRM
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [Import-Module], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
I have tried several ways, uninstalling and reinstalling etc...but failed. Can anyone please help me?
The answer is right there in the error message, though it's not copied completely from the Powershell console:
Import-Module : ...
its operation is blocked by software restriction policies, such as those created by using Group Pol
This means that a domain SRP prevents you loading the module. Contact your domain administrator to discuss SRP settings.
To fix this you need to change the execution policy by this simple command:
PS c:> Set-ExecutionPolicy RemoteSigned
then reply Y(yes) to the popup to change setting. Now try running again the import command, it will run:
PS c:> Import-Module AzureRM
this worked for me , i hope it helps you too

Cannot install psget

I am trying to install psget on windows 10 from powershell in admin mode but I get:
PS C:\Windows\system32> (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
Downloading PsGet from https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1
Invoke-WebRequest : The given path's format is not supported.
At line:42 char:13
+ Invoke-WebRequest -Uri $Url -OutFile $SaveToLocation
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
+ FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Import-Module : The specified module 'C:\Users\myuser\Documents\WindowsPowerShell\Modules C:\Users\myuser\Documents\WindowsPowerShell\Modules\PsGet' was not loaded
because no valid module file was found in any module directory.
At line:105 char:9
+ Import-Module -Name $Destination\PsGet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Users\myuser\Do...l\Modules\PsGet:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PsGet is installed and ready to use
USAGE:
PS> import-module PsGet
PS> install-module PsUrl
For more details:
get-help install-module
Or visit http://psget.net
PS C:\Windows\system32>
As suggested below PsGet is actually already installed on windows 10. I have then continued with the next step:
and as can be seen it installs successfully (needs to be done running as administrator). After a restart of the powershell console I still don't get any color highlighting though:
Any ideas?
Btw: the folder C:\Users[my-user]\Documents\WindowsPowerShell\Modules is empty:
Um... psget as in PowerShellGet module that I am almost certain comes on Win 10. I believe your error is even telling you that. Where it says PsGet is installed and ready to use.
Looks like the script at http://psget.net/GetPsGet.ps1 tries to decide where to install by querying for #($env:PSModulePath -split ';') and then limit the search for paths under Documents\WindowsPowerShell\Modules.
It appears that in your computer, PSModulePath includes twice the folder C:\Users\myuser\Documents\WindowsPowerShell\Modules, which causes an issue with the installation script.
You can do either one of these two options to solve it:
Remove one instance of C:\Users\myuser\Documents\WindowsPowerShell\Modules from the PSModulePath variable.
Install PsGet manually using the instructions in the official website.

PowerShell windows 2008 missing modules

I apologize if this is a NOOB question but I wrote a PowerShell script on my windows 10 box and I am trying to run the script on a 2008 box. On the new install of the 2008 box I had to add the windows powershell feature. My end goal is to install the Web Server (IIS) Administration Cmdlets
PS C:\Users\Administrator> Get-Module -ListAvailable | Import-Module
PS C:\Users\Administrator> Get-Module -ListAvailable
ModuleType Name ExportedCommands
---------- ---- ----------------
Manifest BitsTransfer {}
Manifest PSDiagnostics {Enable-PSTrace, Enable-WSManTrace, Start-Trace, Disable-PSWSManCombined...
PS C:\Users\Administrator>
PS C:\Users\Administrator> add-pssnapin WebAdministration
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
At line:1 char:13
+ add-pssnapin <<<< WebAdministration
+ CategoryInfo : InvalidArgument: (WebAdministration:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
PS C:\Users\Administrator>
PS C:\Users\Administrator> Import-Module WebAdministration
Import-Module : The specified module 'WebAdministration' was not loaded because no valid module file was found in any module directory.
At line:1 char:14
+ Import-Module <<<< WebAdministration
+ CategoryInfo : ResourceUnavailable: (WebAdministration:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId :Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Any ideas?
You need to install the IIS managment tools before the WebAdministration-module is available. Try (tested on Win10):
Enable-WindowsOptionalFeature -Online -FeatureName "IIS-WebServerManagementTools" -All
Windows Server 2008 doesn't come with a PowerShell module for managing IIS. That feature was added with Windows Server 2008 R2. You need to download and install it first. See here for further information. See also this related question.

Error when adding SharePoint Powershell snapin

When I run Add-PSSnapin microsoft.sharepoint.powershell I get
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 3.
At line:1 char:1
+ Add-PSSnapin microsoft.sharepoint.powershell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (microsoft.sharepoint.powershell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
I know this sounds dumb but I have searched Google for about 12 hours trying to just add this snapin. Im writting my first shell script and just need help getting off the start
What is your SharePoint version, 2010 or 2013?
What is your Powershell version? ($PSVersionTable.PSVersion)
SharePoint 2010 expects PowerShell version 2, which you can get to by running powershell -version 2
NB.
(To the commenter above)
If you dont have SharePoint installed on the PC you get this message.
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.SharePoint.PowerShell' is not installed on this machine.
At line:1 char:13
+ Add-PSSnapin <<<< Microsoft.SharePoint.PowerShell
+ CategoryInfo : InvalidArgument: (Microsoft.SharePoint.PowerShell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
From your question I can understand you are using powershell version 3.0.
Please reboot your system and then try to add the snap-in.. It should work for you.