ReportingServicesTools module is not digitally signed - powershell

The current ExcutionPolicy is AllSigned; however, I am attempting to automate the deployment of SSRS packages via the ReportingServicesTools module that Microsoft published (see link below). My deployment implementation is a scrip that calls a series of commands that are made available within the ReportingServicesTools module. Unfortunately, when I try executing the script, I get the following error:
C:\...\ReportingServicesTools.psm1 is not digitally signed. You cannot
run this script on the current system.
I am able to run the script when I change the ExecutionPolicy to RemoteSigned. However, this may run afoul with our company's policies.
Before I address this internally, is there anyway that I can get the script to run under an AllSigned ExecutionPolicy? I have checked online and everything seems to point to changing the ExecutionPolicy to RemoteSigned. So, I assume the answer to my question is no, but I first want to check here that way I have left no stone un-turned.
ReportingServicesTools:
https://www.powershellgallery.com/packages/ReportingServicesTools/0.0.4.8

Related

Problems Signing a PowerShell Script

I am trying to sign a simple script to show my students. When I sign the script, which I created in Notepad, I get an unknown error using Set-AuthicodeSignature. When I look at the script after trying to sign in Notepad is shows a signature block. When I try to run it says the PowerShell says the script is not signed. I am using an executionpolicy of AllSigned. Any suggestions? The script runs fine if I set the executionpolicy of Unrestricted.
For the error in Set-AuthenticodeSignature, Chances are your character encoding is not in UTF-8. You can change the character encoding to UTF-8 within notepad and things will work just fine. This is the most common cause of the "unknown error"
Regarding the next issue, of getting the script to run. From Get-Help about_Execution_Policies the AllSigned policy:
- Scripts can run.
- Requires that all scripts and configuration files
be signed by a trusted publisher, including scripts
that you write on the local computer.
We have a couple of options here. We could trust the certificate that we created at a higher level (by adding it to a trusted store), we can use a different certificate from a root CA, also trusted at a higher level and lastly, we could use a different ExecutionPolicy. Also from Get-Help about_Execution_Policies you may want to try using "RemoteSigned" as that will allow you to run self-signed scripts you wrote on your own machine, as well as trusted scripts downloaded from the internet:
RemoteSigned
- Scripts can run. This is the default execution
policy in Windows Server 2012 R2.
- Requires a digital signature from a trusted
publisher on scripts and configuration files that
are downloaded from the Internet (including
e-mail and instant messaging programs).
- Does not require digital signatures on scripts that
you have written on the local computer (not
downloaded from the Internet).
- Runs scripts that are downloaded from the Internet
and not signed, if the scripts are unblocked, such
as by using the Unblock-File cmdlet.
- Risks running unsigned scripts from sources other
than the Internet and signed, but malicious, scripts.

Internal Server Error in PowerShell cmdlets for Microsoft Dynamics CRM

On Windows Server 2012 Datacenter with Microsoft Dynamics CRM 2016 installed, I want to run a deployment command but for every commands I get this error: "(500) Internal Server Error".
I first run this:
Add-PSSnapin Microsoft.Crm.PowerShell
and it will work fine and when I check it with get-pssnapin and Get-Help *Crm*, every thing is fine and every thing that I need is registered. but when I want to run a cmdlets command like these, I face the error: Get-CrmSetting or Get-CrmCertificate or ...
For example for Get-CrmSetting TraceSettings it give me this error:
How can I solve this problem and error?
Thanks
According to this article, you might want to try:
Get-CrmSetting –SettingType TraceSettings
Here are a couple more items to investigate, from this article:
To use the XRM tooling cmdlets, you need PowerShell version 3.0 or
later. To check the version, open a PowerShell window and run the
following command: $Host
Set the execution policy to run the signed PowerShell scripts. To do
so, open a PowerShell window as an administrator and run the
following command: Set-ExecutionPolicy -ExecutionPolicy AllSigned
Verify the (CRMDeploymentServiceAppPool Application Pool identity) has SQL SEVER SysAdmin permission. This is needed to perform any CRM configuration changes and organizational operations.
Note: it does not matter if the account executing the PowerShell is a system admin or SQL server sysadmin because these operations are executed via the deployment web service.
Deployment Web Service (CRMDeploymentServiceAppPool Application Pool identity)
....Sysadmin permission on the instance of SQL Server to be used for the configuration and organization databases.
....
(500) Internal Server Error, refers to a HTTP response status code. This means that the Powershell command is calling a URL and the URL is reporting a error.
You need to know the URL to really find out what the problem is. One way you can get the URL, is downloading Fiddler Classic. Once installed, you have to enable HTTPS decryption.
In my case the URL was...
https://<my-crm-domain>/XrmDeployment/2011/deployment.svc?wsdl
When I ran this URL on the server where CRM is installed, I got an exception stating...
Could not load file or assembly 'Microsoft.Crm.Application.Components.Application'
All this meant, I needed to copy a file, Microsoft.Crm.Application.Components.Application.dll, from C:\Program Files\Dynamics 365\CRMWeb\bin into folder C:\Program Files\Dynamics 365\CRMWeb\XRMDeployment\bin.
Once this was done, the URL worked and therefor my PowerShell command as well.

enable Powershell script execution on domain

I am working on a mid-size Windows 2012 R2 domain right now, and slapped together a PowerShell login script.
But I can't figure out how to allow regular users to run it!
By default, PowerShell script execution is disabled in a Windows domain.
I am trying to enable script execution using group policies.
I found several sets on instructions, but none have yet yielded the result desired. Here is an example of the instructions I have found:
https://blogs.technet.microsoft.com/poshchap/2015/01/02/execution-policy-and-group-policy/
So far no amount of gpupdate /force or rebooting seems to work.
Does anyone have first hand experience at enabling script execution using group policies?

Cannot run powershell scripts unless I run as administrator

I have set-executionpolicy unrestricted. I was able to run scripts previously. After I got an error running a powershell script, I started getting the following error:
File C:..\test.ps1 cannot be loaded because its operation is blocked by
software restriction policies, such as those created by using Group Policy.
It doesn't matter what is in the script file I am trying to run.
From what I can tell nothing else has changed. I was doing something with a remote powershell session to a remote machine, got an error. Then was unable to run scripts locally unless I run powershell.exe as administrator.
Software Restriction Policies (SRP) have nothing to do with Powershell directly.
Someone has set a restriction on what can be run and/or from where it can be run.
This isn't related to Powershell Execution Policy, Powershell Remoting, nor administrative rights/privileges.
Typically SRP is set through Group Policy and pushed out (I'm guessing you're on a domain).
You could use rsop.msc on your machine to try to determine what the settings are and maybe which policy is applying them.
If you want more information on SRP you should probably post on ServerFault.

Can RemoteSigned run scripts created on same domain?

I'm creating and testing some powershell scripts to do some basic file copying. I've set my executionpolicy to RemoteSigned. According to the help, this should allow me to run scripts that were not downloaded from the internet. However, my observations seem to indicate that this will run only scripts created on the local machine.
For instance, if I create a script on my development machine and try to copy to my server (on my same domain), the script will not run. However, if I open up the Powershell ISE on the server and open my script, copy the code and paste it into a new file window and save it to the server, the script then runs. Further, if I want to create a self-signed certificate, it will not run on other computers (per the help).
So, this all seems a bit cumbersome that I have to develop my scripts on the machine they are to be run or go through the copy/paste routine mentioned above to get them to run on my server. I just want to know that I've understood all of this correctly and there is no other way to create a script within the same domain and run it under the remotesigned execution policy without paying the fee for a certificate.
this post here provide the method for executing script from shared folder. hope this could help you :-)