Is there any free software to package a powershell script into a standalone WIN32 executable?
It seems it was possible to get the powershell beta's to run on win2000 and winNT, is there any known way to get the final powershell to run on it?
I don't think there is any software that will package a PowerShell script into a stand-alone executable. That would require bundling PowerShell itself with the script (no small feat).
The oldest supported OS is Windows XP SP2, so there is not a supported way to get PowerShell to run on NT or 2000.
A easy step would be to create a .NET exe which embedded the script.
This would, of course, require PSH (and any non-standard snapins) installed when executed.
To remove those dependencies you would need to be able to handle any cmdlets used, as noted #aphoria this would be reinventing PSH, and all the snapins.
Not strictly the answer you are looking for (free software), but it may be useful to others. Here are some commercial options for packaging scripts into single executables:
Admin Script Editor
PrimalScript OR PrimalPackager (just packaging portion of PrimalScript)
Related
Recently switched to new windows terminal, and after hours of searching on internet I was not able to find anything helpful, all what I want is to set up cmd inside new windows terminal to show git branches just like it's achievable for powershell.
eg like this
I have been very comfortable with cmd especially with its ability to use additional linux commands and don't wanna switch to powershell only because of nice displays of git branches. this is a source where everything is nicely explained for powershell, all I want is to do the same for CMD.
thanks in advance
In order to use Oh My Posh for shell-prompt customization from cmd.exe, the legacy Windows shell (citing from the docs (tab cmd)):
There's no out of the box support for Windows CMD when it comes to custom prompts. There is however a way to do it using Clink, which at the same time supercharges your cmd experience. Follow the installation instructions and make sure you select autostart.
As you later discovered, this issue on GitHub has background information on why native cmd.exe support isn't possible (even though Oh My Posh is generally shell-agnostic) and why third-party software is needed to make it work.
As for your comments re preferring cmd.exe:
I have been very comfortable with cmd
Migrating from the shell one is used to a new one is undoubtedly a painful transition, but well worth considering in this case:
While not without its quirks, PowerShell is vastly superior in just about every respect to cmd.exe, and enables you to do things you simply cannot do in cmd.exe
its ability to use additional linux commands
Linux (WSL) commands called from the Windows side are all mediated via executables (notably wsl.exe and bash.exe), which you can equally call from PowerShell.
I wonder what guest OS are compatible to the invoke-VMScript cmdlet. The reason I'm asking: I plan to include VMWare in my (automated) test environment. What I read so far:
Windows Server 2008
Windows Server 2012
A Fedora-Version
I would like to know, what windows and linux guest you have experience with and (if appliable) what languages are invokeable. E.g. CMD at windows, or maybe Bash or Powershell at Linux.
According to the documentation powershell bat(cmd) and bash are all supported, I don't have a linux machine handy to confirm but based on this link it looks like you can run powershell on Linux VM's as long as .Net and Powershell have been installed and the machine has been rebooted since this install. Beyond that depending on the VM config you can use any of those methods to create and launch scripts that target just about any language by building them as strings inside of the script that is delivered, writing them to a temp file and then launching the correct interpreter and calling the newly created file. note that there seem to be a bunch of edge-cases here so you may want to review the requirements here
I am distributing an installer and it will open and run a PowerShell script. The installer will be used by people who have Windows XP and up.
Am I guaranteed that this script will run/execute on all these versions of Windows? I'm looking for the similar Cross-Windows-Platform interoperability that Batch files provide.
I've heard of the error: "File cannot be loaded because the execution of scripts is disabled on this system" what can I do in this scenario? If a user has disabled scripts does that mean I will need to use a different language(maybe just Batch)?
The error you're quoting is due to the default execution policy of PowerShell when it's installed. The message indicates that PowerShell is installed,but by default it's very restricted about what scripts may run for security purposes.
See this article for more on the subject.
If you're going to use PowerShell in your installer, make it part of the system requirements for your software. I can't find anything that definitively says you can redistribute PowerShell with your application, but it's worth asking Microsoft about it.
PowerShell isn't "guaranteed" to be on any desktop OS older than Win7, but it is distributed via Microsoft Update and there's no compelling reason for users to not have it installed.
If you manage this environment, then make sure that powershell is installed on the XP workstations before deploying the script. There is also the option of configuring group policy for powershell to enable script execution and what type of scripts to allow, but that's outside the scope of this question.
If you don't go the group policy route, and instead want to just run the script directly, then in your installer, call powershell.exe directly and pass in the following parameters:
powershell.exe -executionpolicy bypass -file \\path\to\script
The script path doesn't have to be a unc path if it's local, that was just an example.
No, PowerShell scripts are not guaranteed to run on Windows XP or Windows Server 2003. Although PowerShell is available for these platforms, it's not installed by default.
No, PowerShell scripts may not work, because the PowerShell isn't pre-installed on Win XP/2003.
It is included in the Management Framework for XP/2003.
For me, I suggest to use the .bat instead.
Is there any scripting language available for creating Silent Installation (without giving input and clicking next, agree and finish)...? I want to do unattended installation of NewsGator.exe application in windows server, which scripting would be best..? Thanks in Advance for your reply.
NSIS provides the very simple /S flag for running installers.
It's also extremely easy to create a dead simple installer.
All the MSI installers can support silent installations supplying the input parameters thru the command line in the form of:
installer.exe /v/qn"PARAMETER=VALUE PARAMETER=VALUE"
try autoit, here is an example of how to automate a WinZip install :
http://www.autoitscript.com/autoit3/docs/tutorials/winzip/winzip.htm
I have used it to automate several installs in the company i work with, its pretty straight forward.
As a LAMP developer considering moving to a .Net IIS platform, one of my concerns is the loss of productivity due to lack of shell... Has anyone else had this experience? Is there possibly a Linux shell equivalent for Windows?
Depending on what version of IIS you're considering, I would second lbrandy's recommendation to check out PowerShell. Microsoft is working on a PowerShell provider for IIS (specifically version 7). There is a decent post about this at http://blogs.iis.net/thomad/archive/2008/04/14/iis-7-0-powershell-provider-tech-preview-1.aspx. The upcoming version of PowerShell will also add remoting capabilities so that you can remotely manage machines. PowerShell is quite different from *NIX shells, though, so that is something to consider.
Hope this helps.
Are you asking about Linux shell as in an environment to work in? For that CygWin I think has been around the longest and is pretty robust: http://www.cygwin.com/
A while ago I found a windows port of all the popular linux commands I use (ls, grep, diff) and I simply unzip those to a file, add it to my PATH environment and then can run from there: http://unxutils.sourceforge.net/
Or are you talking about executing shell commands from within your code? If you're in the .NET sphere, there is the Process.Start() method that will give you a lot of options.
Hope this helps!
I assume you don't mean cygwin, right?
How about powershell, then?
If you're referring to simply accessing your IIS server from a remote location, remote desktop generally solves that problem. Assuming your server has a static IP address or a host name you can access from the internet, remote desktop is a simple and relatively secure solution.
Is there a problem with this answer? Now I have negative reputation...
The best way I can think of would be to use Cygwin over an OpenSSH connection.
Here's a document that explains how to do just that:
http://www.ucl.ac.uk/cert/openssh_rdp_vnc.pdf
Remote shell doesn't solve the productivity issue. (It merely makes things possible.)
From what I've heard, everything that the future Microsoft GUI:s do will be possible to do with powershell since the GUI:s use the same API:s as those that are available from powershell.
Personally, I love cygwin but cygwin can not help you manage Microsoft applications.
You might be surprised, however, how powerfull the Windows Scripting Host is when coupled with Window Management Instrumentation. I think IIS is fully manageable with WMI or some COM objects that can be easilly used from a JScript WSH script.
You should make your choice of server platform based on the environment as a whole, and that includes the admin/management interfaces supplied.
I'm afraid that if you don't like the way Windows implements management of IIS, then that's too bad. Having said that, a bit of delving around in the WMI interfaces will generally yield a solution that you should find usable. I used to do quite a bit of WMI scripting (mostly via PowerShell) in order to have a reliable environment rebuild capability.
If you want a Linux shell on Windows, install the Windows Subsystem for Linux on Windows 10 :
The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.