We're setting up an automated build process using Teamcity
We need to have ABCPDF install itself automatically on each server, I'd like to be able to do this from the command prompt/powershell?
Has anyone done this?
Figured it out! Need to run powershell in 32bit mode for this to work.
$abcPdfPath = "C:\temp\abcpdf\ABCpdf.dll"
[Reflection.Assembly]::LoadFrom($abcPdfPath)
if ([WebSupergoo.ABCpdf9.XSettings]::InstallSystemLicense("cd9b5c07fb69sf2bf57c0a04d9bca58b10c44889c9fb197984e592f49addfce5ec5fe85d7b9205bc"))
{
"Successfully Installed"
}
else
{
"Failed"
}
EDIT
Teamcity runs in 64bit mode powershell which caused problems with the above script. There are two ways of getting around this. Once is to launch a 32bit version of powershell from powershell running the script. Alternatively; the approach we took was to create an executable with the above command and run that from powershell. This worked nicely.
Related
CONTEXT:
Found a script on SO to download files from URL in PowerShell v2.0 (I am using Windows 7)
PowerShell.exe -ExecutionPolicy Bypass -Command "(New-Object System.Net.WebClient).DownloadFile( 'site.com/file.txt', 'file.txt' )"
Used a batch file .bat to run this script inline.
Works great -- for zip and images!
PROBLEM: Once I try downloading an .exe from URL, the batch file runs WITHOUT executing Powershell script. And Powershell.exe stops working completely in Windows 7...
Powershell (x86) still works, on the other hand.
Opening powershell.exe (x64) directly from folder: C:\WINDOWS\system32\WindowsPowerShell\v1.0 only opens blank window and closes immediately
Tried using sfc /scannow and DISM /Online /Cleanup-image /Restorehealth, but it's not working because Windows 7 doesn't have that option
Running the batch script again works, but the powershell part is skipped
I believe it works again after rebooting (haven't tested properly), but I can't seem to make Powershell (x64) work again without rebooting :/ I don't even know what the problem is as I don't know where to start debugging.
This question might be better suited for superuser.com, but I'm asking here first -- thanks for help :)
As #JCWasmx86 pointed out, it was indeed my Antivirus blocking Powershell.
I tested it extensively with Malwarebytes and Avast in different states -- turned off both of them, then switched them on one by one and ran my script after each state change. Turns out, once Avast got enabled, Powershell (x64, or the default one) got silently blocked after script execution, and persisted inactive until reboot or enough time had passed.
This only happened with .exe files. Avast must not like scripts downloading unverified exe files from the internet.
I am trying to install Emscripten on my computer, and I have run into trouble getting Emscripten actually installed.
I am using the same commands as can be found on the project webpage, but when I try to run
emsdk install latest
Powershell (which is what I am using, but the basic command prompt is behaving the same way) doesn't do anything at all - it just returns without installing anything.
For reference, I have installed Emscripten on this same computer before, but decided to try and do a fresh install of Emscripten after running emsdk activate latest decided to "stop working" as well (whereas it worked just fine last week) - running the command, Powershell simply returned without actually doing anything.
Any ideas on what to check to see why these commands don't seem to run?
I think I solved it. When running the install command in Powershell ISE, it threw the error "Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640"
despite me having Python installed. Changing the order of my PATH variables to set my Python install directory above the Winapps directory solved the issue with running the install command.
I compiled an AutoIt script and uploaded it to a server. I then wrote a PowerShell script which downloads the compiled AutoIt script and runs it locally.
When I run the PowerShell script on Windows 7 it runs without issues. But when I run the PowerShell script from an application, the compiled AutoIt script does get downloaded but does not run to completion. It does appear in task manager.
Without seeing the script it is hard to say for sure. However, it might be a rights issue. Try adding this to the top of your script and see if it fixes the problem.
#RequireAdmin
I have to install a program on a Windows 8 server using Jenkins as a framework. I wrote a PowerShell script that does run and install executable files when run through the PowerShell console. This does not happen when I run the same scripts through Jenkins.
Nothing happens except the text I output does appear on Jenkins' console.
Can running an .exe be done on Jenkins through a PowerShell script? Please help! Thanks :)
Read a similar answer here:
Open Excel on Jenkins CI
The issue is that Jenkins on Windows usually runs in "Session 0". Which is not visible to the logged in user. The trick is to launch the process (Excel in that answer, PowerShell in your case) in session 1.
I was wondering if anyone has successfully ran Nant on Windows Vista 64 bit version. It keeps failing with
set-props:
[sysinfo] Setting system information properties under sys.*
BUILD FAILED
Property name 'sys.env.CommonProgramFiles(x86)' is invalid.
Yes, it works. NAnt is by default built for 32-bit. Therefore, one has to remember to run this in a 32-bit command prompt or PowerShell. I run NAnt scripts out of PowerShell (x86) mode on a Vista 64 machine, but an SDK prompt (32-bit) would works as well.
It also has worked well for me. I do run as Scott said in a 32bit command prompt.
It could also be just a specific thing you are trying to capture that nAnt is not expecting.
I've been using NAnt on my Windows 7 64 bit environment, and have found that in order to do so (without needing to use a 32bit command environment) is to simply remove the reference in your NAnt scripts to sysinfo.
I have been through our build scripts over and over and cannot see any downside to removing this setting, as I cannot prove that I'm using the result of it anyway, other than to dump lots of data to the screen which is invaluable during debugging!!
Hope this helps!