Microsoft.SystemCenter.VirtualMachineManager is not installed on this machine - powershell-2.0

I want to use get-vm command from powershell.
$my_vm = get-vm -Name MY_VM_NAME
Have error message that
The term 'get-vm' is not recognized as the name of a cmdlet, function,
script f ile, or operable program. Check the spelling of the name, or
if a path was incl uded, verify that the path is correct and try
again.
I found that I need to install Microsoft.SystemCenter.VirtualMachineManager
(how to run get-vm command on windows powershell)
Execute that:
PS C:\Windows\system32> Add-PSSnapin -Name
Microsoft.SystemCenter.VirtualMachineManager
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.SystemCenter.VirtualMa
chineManager' is not installed on this machine.
At line:1 char:13
Do I really need to install that huge tool? I don't have enough space on my VM.
http://www.microsoft.com/en-us/download/details.aspx?id=10712
Is it another way to solve issue with get-vm?
Thanks!

You can look in to connecting to the machine that has VMM on it. You can use remoting to do this. You can find some more info about it here: http://windowsitpro.com/scripting/creating-remote-sessions-powershell-20?page=3

Related

Adding printer on windows-docker

We are trying to dockerize some old powerbuilder batch jobs, and the existing code requires a ghostscript printer installed with the exact name (for the details see here)
Microsoft's documentation on Print Spooler in containers
states "apps that have a dependency on installing printer drivers into the host cannot be containerized because driver installation from within a container is unsupported"
I do not know if this is just a typo/missunderstanding, as why would any application want to install driver into host? I need it in the container, also is it only for the drivers or for the Printers as well?
Assuming this is only a typo/missunderstanding, and microsoft claims it can not be done in the container, the question is
could I do it through the host (and commit it into a new docker image)
could I do it through doccker file , using some MSI installer and run it there
is there any possibility to add a driver and printer in docker image ? (and if not it should be clearly stated)
Assuming this the above statement is not a typo/missunderstanding, than it should be possible to add printer to docker. For that we are using
FROM mcr.microsoft.com/windows:1909
and isolation is hyperv
We tried runnig this from the dockerfile
RUN powershell -command Add-Printer -Name \"Test Printer\" -DriverName \"Microsoft Print to PDF\" -PortName \"PORTPROMPT:\"
and get following errror
# InvalidData: (MSFT_Printer:ROOT/StandardCimv2/MS
# FullyQualifiedErrorId : HRESULT 0x80070006,Add-Printer
but I was not able to find anything meangifull for this error
I can list, rename and remove a printer but I can not add existing one, also if I execute
Get-PrintConfiguration "Microsoft Print To PDF"
I am getting
+ CategoryInfo : NotSpecified: (MSFT_PrinterConfiguration:ROOT/StandardCi...erConfiguration) [Get-PrintConfiguration], CimException
+ FullyQualifiedErrorId : HRESULT 0x8000ffff,Get-PrintConfiguration
so it seams there is something fishy with printers in the docker image.
Do you if there is any possibility to add printer to docker image / container?
thanks
almir
Probably your error in in the DockerFile command. You have to pass the hole command to the powershell and not just the Add-Printer.
I did not try it out, but i would do it like this:
RUN powershell -command "Add-Printer -Name \"Test Printer\" -DriverName \"Microsoft Print to PDF\" -PortName \"PORTPROMPT:\""
The question is quite old, but i would be curios to have a beedback :)

I can't create a global gitignore in my terminal. touch ~/.gitignore gives an error

I am trying to create a global .gitignore file with this command:
touch ~/.gitignore
but in my terminal (Cmder) gives this message: "touch: cannot touch '~/.gitignore': No such file or directory"
I have changed to windows terminal default (Command Prompt) and it says:
"'touch' is not recognized as an internal or external command, operable program or batch file."
What I am doing wrong or what can I do to solve this?
You are using linux syntax. Now, even though touch is not understood by cmd prompt, it is a command understood by cmder but expression ~/.gitignore is still linux way of saying things.
What you can do on cmd prompt, I guess also would work on cmder (edit: doesn't seem to work for cmder):
copy con "%USERPROFILE%\.gitignore"
[press F6 and enter after that]
For cmder, this could work:
touch "%USERPROFILE%\.gitignore"
This should help for windows terminal:
echo $null >> pot.txt
touch is linux command not windows command.
Below question should help a lot more :
https://superuser.com/questions/502374/equivalent-of-linux-touch-to-create-an-empty-file-with-powershell

PsExec is not recognized as an internal or external command

I have a job that needs to run a script on a remote computer. I'm doing so by using psexec via "Execute windows batch command":
C:\PsExec.exe \\computername -u username -p password -accepteula c:\xxx.exe
When I run the job I get the following error:
c:\PsExec.exe is not recognized as an internal or external command
** PsExec.exe is located under c:\
Any ideas?
First Define psexec.exe path in environment varaiable "PATH" or else place psexec.exe file in C:\Windows\System32\
And to Download Psexec.exe file
https://download.sysinternals.com/files/PSTools.zip
One possible explanation is the version of PsExec.exe: 32bits or 64bits.
If you have the 32 one on a 64bits machine, that command would not be recognized indeed. PsExec64.exe would.
I can see the age of this question and my answer may not be relevant to this topic since I was technically trying to solve a different problem, but maybe this will help other people who are stuck.
c:\PsExec.exe is not recognized as an internal or external command
I was trying to disable the Maintenance Configurator with PSExec (my problem is the never ending maintenance bug) and kept running into the same error as the OP BUT I got PSexec64 to run this command:
C:\PsExec64.exe -s schtasks /change /tn >"\Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE
BY checking the "Run this program as an administrator" option under the Compatibility settings for "PsExec64.exe"
Don't know if this has solved my problem yet, but I think the OP would have been able to run his process if he had done this. Dear OP did you ever solve that?

Erlang not working with internal Terminal in Visual Studio Code

I am currently having an issue with visual studio code and erlang, I have erlang/OTP installed on my PC, and I have installed the erlang plugin for visual studio code, however I cannot run erlang from the internal terminal window. When I try to I receive this error:
erl : The term 'erl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ erl
+ ~~~
+ CategoryInfo : ObjectNotFound: (erl:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
any help would be appreciated.
From the VS docs
The shell [that is] used [by VS] defaults to $SHELL on Linux and OS X, and %COMSPEC% on
Windows. These can be overridden manually by setting
terminal.integrated.shell.* in settings.
So I would check what the value is of your %COMSPEC% environment variable. Or, you can override %COMSPEC% in the VS settings:
From the VS docs:
Correctly configuring your shell on Windows is a matter of locating
the right executable. VS Code defaults to the %COMSPEC% environment
variable on Windows which typically points to the 32-bit version of
cmd.exe.
Below are a list of common shell executables and their default
locations:
// 64-bit cmd if available, otherwise 32-bit
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe"
// 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
You may also want to check if the path to erlang is in your %PATH% environment variable, and if not add it. Have you ever successfully started up the erlang shell before, e.g. after you installed erlang to test that it was working?
Try the following guide and install erlang
https://www.rose-hulman.edu/Users/faculty/young/CS-Classes/resources/Erlang/index.html

Docker: Looks something went wrong in step Looking for vboxmanage.exe

I just installed Docker Toolbox on my windows 7 machine.
After installing I run the Docker Quickstart terminal which displays the following message:
Looks something went wrong in step nLooking for vboxmanage.exen... Press any key to continue....
Anyone here who knows how to solve this?
Regards,
The same thing happened to me. At this moment I am using Windows Home.
At least in my case, what happened was that the environment variables DOCKER_MACHINE and DOCKER_TOOLBOX_INSTALL_PATH were not created for the system.
I just had to add them and it worked.
Solved the problem by cleaning my .bashrc file.
More specific, i removed the cd , which makes perfectly sense.
For me, the problem was that the DOCKER_TOOLBOX_INSTALLPATH was only set for the user used to escalate priviligies at installation. When I run Docker Quickstart as my regular user, the DOCKER_TOOLBOX_INSTALLPATH variable is empty, producing the error.
Setting DOCKER_TOOLBOX_INSTALLPATH system wide solved the problem.
I'm Windows 8.1 user, I got the same problem when I installing the Docker Toolbox.
Because I have a previous version of VirtualBox installed, so I uncheck the VirtualBox install option in the Docker Toolbox installer.
After the install and I run Docker Quickstart terminal and get the same problem looks like something went wrong in step 'looking for vboxmanage.exe'.
Look at the file D:\Docker Toolbox\start.sh, there are some code fragment:
STEP="Looking for vboxmanage.exe"
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
The start.sh use $VBOX_MSI_INSTALL_PATH and ${VBOX_INSTALL_PATH} Environment Variables to locate the VBoxManage.exe.
And I find my system variables VBOX_MSI_INSTALL_PATH is
D:\VirtualBox
and then, I change it to
D:\VirtualBox\
It works fine!
Or maybe you miss the VBOX_MSI_INSTALL_PATH/VBOX_INSTALL_PATH Environment Variables.
This is my first answer on stackoverflow, I hope this will help you! Finally forgive my poor english ):
For me, it helped to start Docker Quickstart Terminal with admin privileges.
This works if you do not have admin rights:
> Setx DOCKER_MACHINE "C:\Program Files\Docker Toolbox\docker-machine.exe"
> Setx DOCKER_TOOLBOX_INSTALL_PATH "C:\Program Files\Docker Toolbox\\"
> Setx VBOX_MSI_INSTALL_PATH "C:\Program Files\Oracle\VirtualBox\\"
The double backslash in the end makes sure that the variable is saved with one backslash as last character, needed in C:\Program Files\Docker Toolbox\start.sh:
> echo %DOCKER_TOOLBOX_INSTALL_PATH%
C:\Program Files\Docker Toolbox\
Running docker as Administrator solved the problem for me.
I had the same issue.
Inside your toolbox installation folder you should be able to find the installers folder, there you'll find a setup.exe for a Oracle Virtual Box. Double click it, install it and you should be able to reopen the Docker Quickstart with no problems.
Hope this helps!
Cheers! :D
Simple solution: I thought I could just double click on it, but instead need to bring up a windows command prompt, CD to C:\Program Files\Docker Toolbox , and type
sh start.sh
Due to the relative DOCKER_MACHINE path definition on L10, it seems that start.sh will only run when you are inside its directory. I fixed it by modifying the target of the "Docker Quickstart Terminal" shortcut as follows:
C:\Tools\Git\git-bash.exe -c "cd /c/tools/docker; ./start.sh"
Substitute the paths to GitBash and Docker Toolbox to match your installations. If your paths contain spaces, be sure to wrap them in quotes as usual. For example:
"C:\Tools\Git Bash\git-bash.exe" -c "cd '/c/tools/docker toolbox'; ./start.sh"
For context, I had GitBash and VirtualBox already installed before installing Docker Toolbox, so I deselected those options during its install. I'm sure that if I went with the default options, this issue wouldn't have happened. That's probably why some folks on GitHub suggest uninstalling VirtualBox and re-installing Docker Toolbox. Don't do that, it's almost certainly unnecessary.
Do you know how good an open-source program is?
You can actually investigate the issue yourselve, which could be way more precise.
please scroll the quickstart terminal up and see which error message you have got
open C:\Program Files\Docker Toolbox\start.sh (Where you install docker toolbox) with text editer, e.g. sublime text
and see the codes
if it is in step "looking for vboxmange.exe", it should be before STEP="Checking if machine $VM exists" and there are only 50 lines to read
As of 2018-11-27, the only two error that could be given in this step is from these lines, so investigate and find your error in it:
which are:
if [ ! -f "${DOCKER_MACHINE}" ]; then
echo "Docker Machine is not installed. Please re-run the Toolbox Installer and try again."
exit 1
fi
if [ ! -f "${VBOXMANAGE}" ]; then
echo "VirtualBox is not installed. Please re-run the Toolbox Installer and try again."
exit 1
fi
In which:
DOCKER_MACHINE="${DOCKER_TOOLBOX_INSTALL_PATH}\docker-machine.exe"
And
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
So, check your environmental variables and echo it.
In my case, the reason is that DOCKER_TOOLBOX_INSTALL_PATH is an admin user variable:
So, run the quickstart terminal as admin user or put the variable under System variable would do the work
I personally solved this issue by adding the following property to my env (Windows Env variables):
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox\
as pointed out by the start.sh script of the Docker Toolbox installation.
You can solve this reinstalling the VirtualBox, choosing repair mode.
C:\Program Files\Docker Toolbox\installers\virtualbox -> virtualbox.exe
enter image description here
After finished the process, restart you machine and smile!
For Windows 7 users:
Change value "C:\Program Files\Oracle\VirtualBox\" to "C:\Progra~1\Oracle\VirtualBox\" for VBOX_MSI_INSTALL_PATH system variable in environment variables.
If you are running docker from admin cmd then just try to scroll up and you will get the error message, and then you can solve the issue.
For me the the error "Docker Machine is not installed. Please re-run the Toolbox Installer and try again."
But unfortunately reinstall did not solve the issue.
I also had this problem on Win 10 Home and I tried probably every solution from this topic but nothing works, only thing that worked for me was hardcoding Path to VBOX in start.sh.
So in start.sh in this part:
STEP="Looking for vboxmanage.exe"
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
I did this:
STEP="Looking for vboxmanage.exe"
if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then
VBOXMANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
else
VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe"
fi
And this works very well.
I know that this solution(hardcoding path) isn't best possible but it's only one which worked for me, and I think that sometimes it's better to use bad solution which works than good one which didn't work
This happens when the user connects to some sort of secured networks using VPN, TLS machine certs gets messed up, upon restarting machine and regenerating TLS machine certs, docker toolbox is configured to use the default machine with IP 192.168.XX.XX
In windows 8.1, I solved the problem by just adding extra \ to the DOCKER_TOOLBOX_INSTALL_PATH environment variable.
Installer has created the user variable for admin as DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
, but it should be
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox\
For people that installed docker with chocolatey you need to install VirtualBox separately from docker with choco install virtualbox and set environment variables as this
DOCKER_MACHINE == "C:\Program Files\Docker Toolbox\docker-machine.exe"
DOCKER_TOOLBOX_INSTALL_PATH == "C:\Program Files\Docker Toolbox\"
VBOX_MSI_INSTALL_PATH == "C:\Program Files\Oracle\VirtualBox\"
don't forget to add \ at the end of the folders
I faced same issue on my Windows 7 machine and below steps has resolved the same
Went to C:\Program Files\Docker Toolbox\installers\virtualbox and doubleclick virtualbox.msi to install Oracle Virtual box. (Note : It will install andd ask permission for 3-4 more components, Grant them all)
Set up the Env Variables
DOCKER_MACHINE C:\Program Files\Docker Toolbox\docker-machine.exe
DOCKER_TOOLBOX_INSTALL_PATH C:\Program Files\Docker Toolbox
Restart the machine
Finally Open Docker Quickstart Terminal and give it some minutes (probably 5-10) to let it do the setup
I am having the same issue with the vboxmanage.exe upon running my docker toolbox.
I managed to solve the problem by installing virtualbox since I did not install virtualbox on my computer.
Might as well give it a try.
Docker Tool Box is not a standalone application. It has many other tools like Oracle Virtual Box, Git & docker engine itself.
./start.sh is seeking some existing configuration which might miss in the older version. I updated the GIT version from 2.0.x to 2.12.x & it works for me.

Resources