I am new to server core installations so to understand them better I created a VM through Hyper V, installed Windows Server 2012 as Server Core. Accessed the computer and kept trying to run the Netdom.exe RenameComputer function.
I switched over to my main server and then switched back and I have lost the Command Line prompt.
How do I get this back? Cntrl+Alt+Del do not seem to have an option to launch it?
Press CTRL+ALT+DELETE, click Start Task Manager, click File, click Run, and then type cmd.exe. Alternatively, you can log off and log back on.
Press Ctrl+Shift+Escape to run Task Manager. Choose Expand Details, then File | Run | cmd.exe.
Or File | Run | powershell.exe if you want PowerShell instead of Command Prompt (which you should :-).
Related
I'm trying to install IBM Cloud CLI but there is a problem faced me when I do this.
I added the Path to environment variables but it didn't work too !
This happens because the iex (shorthand for Invoke-Expression) command is a Powershell command, but it is entered to Command prompt. The latter is the old command shell that dates back to the MS-DOS days of the 80's.
One can tell the difference from the fact that the window title bar says Command Prompt, not Powershell. Often - not always! - a Powershell session has blue background and command has black.
To run Powershell commands, start a Powershell session either by typing powershell and pressing enter into a command session, or by opening Windows Start menu and typing powershell (followed by enter).
I have a .msi file in my remote machine which is in a different domain from my local machine. I am able to connect to the remote machine with powershell but how can I install the msi there. The installation process has a lot of inputs to be given along with pressing 'Next' and then again giving a particular input and radio buttons and many more. Thus it is an interactive installation. In my local I am able to do it with [System.Windows.Forms.SendKeys] to imitate the keyboard inputs but as the process will be running in background in the remote machine I don't think SendKeys will work. And 'psexec' is not an option here because in my remote machine I cannot include PSTools with my Powershell. Is there any way to do it with Invoke-Command and -ArgumentList??
If there is a way then how can I choose sequentially whether to input a text in a particular field or click the next button or click any other button within the application window??
I finally got to solve this puzzle with the help of a automation tool called AutoIt. This tool has its own scripting language and can create .exe files to run a particular application and do the corresponding installation steps based on each successive window the application installer pops. After creating the .exe I copied it to my remote machine using Copy-Item or you can use robocopy, then invoked the .exe remotely with the help of psexec. As I had the misconception previously about psexec, it only needs to be integrated with powershell at the local and thus it automatically creates a session of its own and interacts with the remote machine. This is the command to run the .exe on remote machine:-
psexec -i 2 -s -d \\remote_machine_name -u Username -p Password C:\Path_to_exe\installer.exe
You can actually log on to the remote machine and see in the GUI that it is happening. And yes, obviously you need to have the .msi which will be called to be present there in the remote machine so that the .exe can do its job locally in the remote session.
I have strange problem with new servers where is installed Windows Server 2016 Datacenter Core (Insider Preview 16257), Powershell 5.1. I can see all the commands used with up and down arrows, but I get nothing with Get-History cmdlet. Even when I enter some new cmdlets, Get-history did nothing at all. I need to save the history. I'm logged in with the same credentials. Thanks
Starting with Windows 10 / Server 2016, the PSReadline Module is included by default. This includes it's own per user history file. This file can be found with this command: (Get-PSReadlineOption).HistorySavePath.
This file is separate that than the per session history that is accessible with the Get-History command.
Running Firebird 2.5 as a service on a local 64-bit Windows 10 machine.
isql, qli and a bunch of the other tools run just fine.
However when I try an launch gfix, gbak and gstat the window barely opens before disappearing. It does this so quickly nothing is visible.
Any recommendations for dealing with this?
My actual goal at the moment is to change a firebird database from read-only to read-write. Which you can do using gfix http://www.firebirdsql.org/manual/gfix-dbmode.html
If there is some other method to change to read-write I'd happily use it.
The tools gfix, gbak and gstat are command line utilities. They expect certain command line options, and they print their output to the console. If you start them by double-clicking them in explorer, or executing them from the Run prompt, a console is opened, output is written (the usage information as you haven't specified the necessary command line options), and then it exits, closing the console immediately.
This means that if you want to run them and see the output, you need to execute them from the command prompt (cmd), or from a batch-file that has pause at the end.
The fact qli and isql work by opening them from explorer (or run) is because they are interactive tools, waiting for your input.
Does anybody have an example of how to create a windows service on windows 7 64-bit from PERL script?
On windows XP professional 32-bit, I have created windows service successfully with Win32::Daemon which has call back functions. This doesn't work on 64-bit.
I have seen this http://nssm.cc/usage and created a service using that but it doesn't keep state and it gives errors. If anybody has a proper example perhaps ...
Some idea much appreciated.
I managed to solved this now.
I now have my perl script running as a windows service now on windows 7 64-bit.
Basically win32::Daemon works on win 7 64-bit but the service creation needs to be done manually. I.e. the callback functions and start up is fine.
Here is a example to create perl windows service from scratch.
Create folder c:/myservice
Copy the code example from this link and save it to the directory above. Call it myservice.pl (http://www.roth.net/forums/topic.php?id=106)
Add these two lines after the print hello statement in the script.
$Context->{last_state} = SERVICE_RUNNING;
Win32::Daemon::State( SERVICE_RUNNING );
This is needed to keep the service running. Otherwise it stops.
Open a Dos cmd terminal in admin mode. Create service using following command
% sc create myservice binpath= "c:\strawberry\perl\bin\perl.exe"
It will display following message on success.
[SC] CreateService SUCCESS
Now we need to edit the registry. Open registry editor. (start -> then type regedit)
Find the service under HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet->Services->myservice
Click on 'myservice' and edit the imagePath variable to be :
c:\strawberry\perl\bin\perl.exe -I "C:\myservice" "C:\myservice\myservice.pl" --run
Now open the services window and start the service. (start->control panel -> Administrative tools -> services)
In the current directory of the script a log is created and updated every couple of seconds. If using cygwin for windows, you can tail it.
% tail -f *.log
Process will print Hello! periodically ...
Thanks.