Heroku won't load within Visual Studio Code - heroku

heroku : File C:\Users\mar\AppData\Roaming\npm\heroku.ps1 cannot be loaded. The file C:\Users\mar\AppData\Roaming\npm\heroku.ps1 is not digitally
signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
This is the error I'm getting. I've tried running "heroku -v" within the cmd and it works there so I know it was installed correctly. However, when I run the same command in visual studio I get the above error. I'm running visual studio code in admin mode and I installed heroku from admin mode as well.
I also enabled developer mode in my computer settings.

You need to set the execution policy regardless of whether you are running in administrator mode or not for PowerShell.
You can read more about this here
You can also see that it's throwing an error with regards to execution policy. The error basically means that windows could not verify the identity of the user that created the script and is blocking you from running it because it may be harmful (based on the fact that it could not verify the identity of the file creator).
This is just a counter-measure to prevent malicious scripts from running automatically.
If you want to run the script I would suggest running
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
and then running the Heroku commands. The above script removes restrictions on script executions on the current logged in user.

Related

IIS wont run bat file (UAC Virtualization problem)

IIS hosts a .Net Core that simply needs to run a bat file. The file is part of the project.
On the local machine, everything works properly, but on the server, the bat file is not triggered because it is blocked by UAC virtualization.
On the server, the double-click script runs smoothly, but cannot be started automatically by .NetCore
.Net core has admin rights to execute the script, also AppPool has the
rights to execute the script. But the script simply stays blocked by
UAC.
I tried to completely disable UAC and restarted the server but again the same.
I tried to create a shortcut with admin rights that will run the script but without success.

problems when install postgresql on windows server 2008

I'm trying to install PostgreSQL 9.0.1 on Windows Server 2008, but every time, there will be such error message
"Problem running post-install step. Installation may not complete
correctly. Failed to start the database server"
in the installation log, it is due to a failure in initdb.exe, error is
"The program postgres is needed by initdb, but was not found in the
same directory as D:\PostgreSQL\9.0\bin\initdb.exe, Check your
installation."
I searched such error in internet and tried the solution in this page "Installing PostgreSQL on Windows Server 2008", but no help.
After reading code of initdb, I know it is caused by the window api CreateProcess in the function pipe_read_line. the calling of CreateProcess returned -5 (access denied). it is because initdb was executed in a subprocess invoked in the functiion CreateRestrictedProcess.
I know it is due to privilege setting, I ran gpedit.msc to add users group (even everyone) into almost all privilege policy, but the error was still there.
I also assigned full control rights of the install target folder to everyone, no help!
I also tried postgresql 9.6.2, the error was still there :-)
from the code, I know if there is the environment variable PG_RESTRICT_EXEC with value 1, initdb will not executed in a restricted process. so before run initdb.exe, I set an environment PG_RESTRICT_EXEC=1 in command prompt, then run initdb.exe. this time such error was gone!!
So I wonder how to change the os settings to allow the installation running without error!

Package Manager Console Not Working

I have checked extensively for a solution to the below error to no avail.
When opening Package Manager Console in Visual Studio, I receive an error stating that "There was an error in loading the format data file.. Path --> to file" cannot be loaded because its execution is blocked by software restriction policies. For more information contact your administrator.
These are all of the things i've done to correct but failed.
Running Powershell as an Administrator.. I Set-ExecutionPolicy to RemoteSigned and Unrestricted in powershell(x86), powershell ISE (x86) and also both 64bit versions..
Running Powershell as an Administrator.. I Set ExecutionPolicy -scope for process, currentuser and localmachine to RemoteSigned and Unrestricted.
Reinstalled Visual Studio.
Set the ExecutionPolicy in Registry Editor to RemoteSigned and Unrestricted.
But I am still getting the error.. Can someone please help..
Thanks
Let me know if you tried the following:
PowerShell says "execution of scripts is disabled on this system."
http://sqlish.com/file-ps1-cannot-be-loaded-because-the-execution-of-scripts-is-disabled-on-this-system-please-see-get-help-about_signing-for-more-details/
Powershell profile.ps1 cannot be loaded because its operation is blocked by software restriction policies
if all fails do the below:
It's possible that you changed the execution policy for 64-bit
powershell and the package manager is running 32-bit (or vice versa).
I'd try opening 32-bit console (PowerShell (x86)) and setting the
execution policy there, as the error is definitely pointing to that
kind of resolution.
Make sure you restart visual studio after changing execution policy so
that changes can take effect. Also make sure you changed execution
policy globally with administrator username and password.
Source:file cannot be loaded because the execution of scripts is disabled on this system
As a workaround, I found this solution (more details at stackoverflow.com/a/53433786/8358565)
Execute the following commands in the Package Manager Console
Set-ExecutionPolicy -Scope Process Bypass
Import-Module "your-solution-directory/packages/EntityFramework<your EF version>/EntityFramework.psd1"

Bamboo remote build agent cannot find powershell.exe after installing nodejs

I just installed nodejs on one of my build servers (Win Server 2008 R2) which hosts a Bamboo remote agent. After completing the installation and doing a reboot I got stuck in the following situation:
The remote Bamboo build agent is running as a windows service with user MyDomain\MyUser. When a build with an inline powershell task is executing it fails with the error (from the build agent log):
com.atlassian.utils.process.ProcessNotStartedException: powershell could not be started
...
java.io.IOException: Cannot run program "powershell"
...
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
Loggin on to the server as MyDomain\MyUser, I have checked that powershell is in the path:
where powershell
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
I have tried to restart the service and reboot the machine multiple times. No luck. The only thing that works is if I execute my scripts as a bat file with an absolute path to powershell - but I do not want that.
I have searched for solutions on this, but even though this one seems related: Hudson cannot find powershell after update to powershell 3 - the proposed solutions do not work.
What am I missing here?
If you do a default installation of nodejs you will see that it adds nodejs and npm to the path. Sometimes I have seen that the installer adds a user variable named PATH - it might be that the Bamboo agent decides to read the user path without "merging" it with the system path. I think it would be worth a try to give that a look.
As per Atlassian support page, this is related to a bug in Java Service Wrapper. I tried Workaround-2 since there was no user PATH variable in my system. I had to uninstall bamboo agent service and Java 64 versions from the agent machine to apply the workaround-2.

VS error when creating new WebAPI project

When I create a new WebAPI project (MVC4) I get the following error.
EntityFramework.5.0.0: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
jQuery.1.7.1.1: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
After Googling I have found a few answers but nothing that works yet.
Error creating new MVC project - EF and JQuery
This answer seems like it should work for me as my last project was a 7z Command Line app and I might have done something daft with 7zip. But I copy pasted the 7-Zip directory from Program Files to Program Files (86) with no luck.
http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/c934fed4-e44e-4a06-9e3b-eccb9c8aa8d6
There is an answer here that might work (I haven't tried it) but even if it does work I wouldnt want to do this every time I create a new project.
Is anyone able to help me with this one?
I got around a similar error by running PowerShell as administrator with the command Set-ExecutionPolicy Unrestricted, restarting Visual Studio, and opening the Package Manager Console before what I wanted to do.
Make sure you understand the security implications of doing this first.
http://technet.microsoft.com/en-us/library/ee176961.aspx
Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned - Only scripts signed by a trusted publisher can be run.
RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted - No restrictions; all Windows PowerShell scripts can be run.
I encountered this issue recently, after re-install VS and install the latest VS update 2, things go well. This works for me at least.

Resources