I am trying to install SQL Server 2008 and during the pre requisite check its always fails on
WMI service "Failed".
I went to the event viewer and found this error in there.
"Failed to Initialize WMI Core or Provider SubSystem or Event SubSystem with error number 0x80040154. This could be due to a badly installed version of WMI, WMI repository upgrade failure, insufficient disk space or insufficient memory."
I know there is a lot of space available in my hard drive. Also i tried a few things after googling like WMIFIX.bat file. The file ran fine but did not fix the problem.
Has anyone had this problem? If so do you have a solution?
if you have a domain so Run this Command with administrator Privilege
you can copy this Command and Past in Notbat with .bat extention. and run them.
Rundll32 setupapi,InstallHinfSection Ndi-Steelhead 132 %windir%\inf\netrass.inf
Netsh firewall reset
sc config SharedAccess obj= LocalSystem password= "" type= interact type= own
sc config RpcSs obj= LocalSystem password= "" type= interact type= own
sc config RpcLocator obj= LocalSystem password= "" type= interact type= own
sc config winmgmt obj= LocalSystem password= "" type= interact type= own
sc config Wmi obj= LocalSystem password= "" type= interact type= own
net start winmgmt
net start Wmi
net start RpcSs
net start RpcLocator
net start WmiApSrv
netsh firewall add portopening TCP 135 "Open Port 135"
netsh firewall add portopening TCP 445 "Open Port 445"
netsh firewall add portopening TCP 139 "Open Port 139"
netsh firewall set opmode mode=DISABLE
shutdown /r
if your problem did not solve you Can execute this Command in Command Prompt with admin privilege.. you can just copy and paste them in notepad and rename it with .bat extention an run the file..
net stop winmgmt
C:
cd %systemroot%\system32\wbem
rd /S /Q repository
regsvr32 /s %systemroot%\system32\scecli.dll
regsvr32 /s %systemroot%\system32\userenv.dll
mofcomp cimwin32.mof
mofcomp cimwin32.mfl
mofcomp rsop.mof
mofcomp rsop.mfl
for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s
for /f %%s in ('dir /b *.mof') do mofcomp %%s
for /f %%s in ('dir /b *.mfl') do mofcomp %%s
echo DONE reboot
pause
just it and have a good day !!!!!
Run the WMI Diag Utility. Here are the instructions how to do this:
Download WMIDiag.
To run the WMIDiag tool:
1. Open a command prompt window.
(Use "Run As Administrator", if applies to your Operating System version)
2. Navigate to the wmidiag folder that was created when you ran Wmidiag.exe.
3. Type cscript wmidiag.vbs.
View what the output of that is and post what it says. That'll give you a better indication of what's happening.
Here is a reference for the above instructions.
I faced this issue when I tried to install SQL Express
For me, following steps worked out which I referred from http://mikeymurph.me/fix-wmi-service-error/
Run the following in Powershell in Administrator mode
PS C:\Windows\system32> winmgmt /verifyrepository
WMI repository verification failed
Error code: 0x80041002
Facility: WMI
Description: Not found
PS C:\Windows\system32> Winmgmt /resetrepository
WMI repository has been reset
Now try to install SQL Server again.
Related
I want to execute a batch file
D:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat
Which is on my server inidsoasrv01.
How should I write my .bat file?
Use microsoft's tool for remote commands executions: PsExec
If there isn't your bat-file on remote host, copy it first. For example:
copy D:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat \\RemoteServerNameOrIP\d$\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\
And then execute:
psexec \\RemoteServerNameOrIP d:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat
Note: filepath for psexec is path to file on remote server, not your local.
You can use WMIC or SCHTASKS (which means no third party software is needed):
SCHTASKS:
SCHTASKS /s remote_machine /U username /P password /create /tn "On demand demo" /tr "C:\some.bat" /sc ONCE /sd 01/01/1910 /st 00:00
SCHTASKS /s remote_machine /U username /P password /run /TN "On demand demo"
WMIC (wmic will return the pid of the started process)
WMIC /NODE:"remote_machine" /user:user /password:password process call create "c:\some.bat","c:\exec_dir"
If you are in same WORKGROUP shutdown.exe /s /m \\<target-computer-name> should be enough shutdown /? for more, otherwise you need software to connect and control the target server.
UPDATE:
Seems shutdown.bat here is for shutting down apache-tomcat.
So, you might be interested to psexec or PuTTY: A Free Telnet/SSH Client
As native solution could be wmic
Example:
wmic /node:<target-computer-name> process call create "cmd.exe c:\\somefolder\\batch.bat"
In your example should be:
wmic /node:inidsoasrv01 process call create ^
"cmd.exe D:\\apache-tomcat-6.0.20\\apache-tomcat-7.0.30\\bin\\shutdown.bat"
wmic /? and wmic /node /? for more
With all the new security updates from Microsoft in the latest operating systems it is becoming more and more difficult to connect and execute scripts remotely. PsExec is one tool that helps you to connect a windows host from another windows host and execute command(s) or a script. Limitation of this tool is that it will execute the command(s) or a script, but it will not print the execution details. It will only return the process id.
C:\apps\tools\psexec \\%RemoteHostName% -u %Domain%\%userName% -p %userPassword% -accepteula -d -h -i 1 cmd.exe /c "cd C:\apps\test\ & echo Hello World" & call C:\apps\test\script.bat
While I would recommend against this.
But you can use shutdown as client if the target machine has remote shutdown enabled and is in the same workgroup.
Example:
shutdown.exe /s /m \\<target-computer-name> /t 00
replacing <target-computer-name> with the URI for the target machine,
Otherwise, if you want to trigger this through Apache, you'll need to configure the batch script as a CGI script by putting AddHandler cgi-script .bat and Options +ExecCGI into either a local .htaccess file or in the main configuration for your Apache install.
Then you can just call the .bat file containing the shutdown.exe command from your browser.
We use kerberos authentication for connecting to our on-prem computing environment. I'd like to use visual studio code remote to do development directly on that server. Based on this section in the vscode remote documentation, it seems like it's possible to use password-based authentication, which works for me, but it would be nice if I could use existing kerberos authentication, instead of having to type my password every time I start up a vscode session.
I've tried searching through the documentation above, but I can't figure out if kerberos is supported. I would like to know if I should respectfully raise an issue on the issue tracker.
Update from March 2020.
I've used plain PuTTY (plink.exe) to connect from VsCode with kerberos using those simple steps.
Define a session inside PuTTY that opens a ssh shell to your remote machine, save it as remote.
Create "C:\Users\< youruser >\ssh.bat" with the contents below. You need echo to fool VsCode that it's OpenSSH client.
echo OpenSSH
SET mypath=%~dp0
powershell %mypath%ssh.ps1 %*
Create powershell script ssh.ps1 in the same folder with these contents:
$ArgArray = [System.Collections.ArrayList]$Args
$ind = $ArgArray.IndexOf("-F")
if ($ind -ge 0) {
$ArgArray.RemoveAt($ind)
$ArgArray.RemoveAt($ind)
}
Write-Host $ArgArray
& 'C:\Program Files\PuTTY\plink.exe' $ArgArray
Theoretically you can write it in batch language but I did not want to suffer.
Set "remote.SSH.path" setting in VsCode to your ssh.bat path.
Finally, add ssh host configuration in vscode and use session name as host:
Host remote
HostName remote
User <you ssh user>
My tweak on #Roman's batch script
#echo off
for %%x in (%*) do (
REM Handle -V
IF "%%x" == "-V" GOTO :version
REM Handle vscode remote as special for plink only
IF "%%x" == "remote" GOTO :plink
)
REM use the built in ssh by default
GOTO :default_ssh
:version
echo OpenSSH
GOTO :eof
:plink
powershell -NoProfile -ExecutionPolicy Bypass %~dp0ssh.ps1 %*
GOTO :eof
:default_ssh
ssh.exe %*
GOTO :eof
It allows you to only use plink for the vscode "remote" server name (I have my reasons), so everything behaves as normal unless you choose hostname remote
Currently this is not possible. There is a feature request about this which has been closed because it will not be implemented in the foreseeable future.
If you have a Kerberos-integrated SSH client for Windows it should work.
I'm not sure if the Microsoft openSSH for Windows 10 / Server 2019 is Kerberos-integrated or not. The one that comes with Git for Windows is not.
If you have a Kerberos-enabled version of PuTTY, you can make a small hack to use plink.
This broke with the June release
Create the file C:\Program Files\Microsoft VS Code\bin\ssh.bat
The file location will be different if VScode is installed in your home directory.
Put the following in the file. Adjust the plink path to your PuTTY directory.
"C:\Program Files (x86)\Centrify\Centrify PuTTY\plink.exe" -ssh -K %*
I wrote a very tiny wrapper for plink.exe.
(It just fakes version string with openssl's and remove unsupported '-T' option.)
I don't use with kerberos but it might help with settings like aviso's answer.
Please give it a try.
I would have commented on Roman answer, but it appears I do not have enough reputation.
I followed his steps, except that I put the plink.exe path for "remote.SSH.path" instead of the "ssh.bat". My path to plink.exe is simply "C:\Program Files\PuTTY\plink.exe".
I tried multiple things and to date, this is the only one that worked for me.
Another tweek for #Roman's and #Andy's ssh.bat script that worked for me; I specify several hosts to use plink.
#echo off
if %1 == -V GOTO :version
if %4 == "myFirst.remoteHost.address" GOTO :plink
if %4 == "mySecond.remoteHost.address" GOTO :plink
if %4 == "myThird.remoteHost.address" GOTO :plink
REM use the built in ssh by default
GOTO :default_ssh
:version
echo OpenSSH
GOTO :eof
:plink
powershell -NoProfile -ExecutionPolicy Bypass %~dp0ssh.ps1 %*
GOTO :eof
:default_ssh
ssh.exe %*
GOTO :eof
I am trying to verify that the usbstor driver is set to disabled on a remote machine in my domain in a vbscript but I'm having issues. I've turned to troubleshooting from the command line.
Using plain old reg query fails.
reg query \\hostname\hklm\system\currentcontrolset\services\usbstor /v start
ERROR: The network path was not found.
But if I run essentially the same command with winrs, it works fine.
winrs -r:hostname reg query hklm\system\currentcontrolset\services\usbstor /v start
HKEY_LOCAL_MACHINE\system\currentcontrolset\services\usbstor
start REG_DWORD 0x4
Both commands work fine on other computers. What gives with this one?
Regardless of the computer I'm running the commands against, I open the firewall with this command:
winrs -r:hostname netsh advfirewall firewall set rule
group="Windows Management Instrumentation (WMI)" new enable=yes
The service RemoteRegistry is not running (or not accessible) on the remote host. You should be able to start it like this:
sc \\hostname config RemoteRegistry start= auto
sc \\hostname start RemoteRegistry
If the service is running but still not accessible, check that the Windows Firewall allows RPC.
I want to execute a batch file
D:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat
Which is on my server inidsoasrv01.
How should I write my .bat file?
Use microsoft's tool for remote commands executions: PsExec
If there isn't your bat-file on remote host, copy it first. For example:
copy D:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat \\RemoteServerNameOrIP\d$\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\
And then execute:
psexec \\RemoteServerNameOrIP d:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat
Note: filepath for psexec is path to file on remote server, not your local.
You can use WMIC or SCHTASKS (which means no third party software is needed):
SCHTASKS:
SCHTASKS /s remote_machine /U username /P password /create /tn "On demand demo" /tr "C:\some.bat" /sc ONCE /sd 01/01/1910 /st 00:00
SCHTASKS /s remote_machine /U username /P password /run /TN "On demand demo"
WMIC (wmic will return the pid of the started process)
WMIC /NODE:"remote_machine" /user:user /password:password process call create "c:\some.bat","c:\exec_dir"
If you are in same WORKGROUP shutdown.exe /s /m \\<target-computer-name> should be enough shutdown /? for more, otherwise you need software to connect and control the target server.
UPDATE:
Seems shutdown.bat here is for shutting down apache-tomcat.
So, you might be interested to psexec or PuTTY: A Free Telnet/SSH Client
As native solution could be wmic
Example:
wmic /node:<target-computer-name> process call create "cmd.exe c:\\somefolder\\batch.bat"
In your example should be:
wmic /node:inidsoasrv01 process call create ^
"cmd.exe D:\\apache-tomcat-6.0.20\\apache-tomcat-7.0.30\\bin\\shutdown.bat"
wmic /? and wmic /node /? for more
With all the new security updates from Microsoft in the latest operating systems it is becoming more and more difficult to connect and execute scripts remotely. PsExec is one tool that helps you to connect a windows host from another windows host and execute command(s) or a script. Limitation of this tool is that it will execute the command(s) or a script, but it will not print the execution details. It will only return the process id.
C:\apps\tools\psexec \\%RemoteHostName% -u %Domain%\%userName% -p %userPassword% -accepteula -d -h -i 1 cmd.exe /c "cd C:\apps\test\ & echo Hello World" & call C:\apps\test\script.bat
While I would recommend against this.
But you can use shutdown as client if the target machine has remote shutdown enabled and is in the same workgroup.
Example:
shutdown.exe /s /m \\<target-computer-name> /t 00
replacing <target-computer-name> with the URI for the target machine,
Otherwise, if you want to trigger this through Apache, you'll need to configure the batch script as a CGI script by putting AddHandler cgi-script .bat and Options +ExecCGI into either a local .htaccess file or in the main configuration for your Apache install.
Then you can just call the .bat file containing the shutdown.exe command from your browser.
I've an issue that seems a privilege issue but i really do not understand what is happening.
This is my installation script :
...some command...
C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil C:\Programmi\ProgDir\ProgService.exe >> log.txt
ping 127.0.0.1 -n 5 > null
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f
ping 127.0.0.1 -n 2 > null
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d C:\Programmi\ProgDir\ProgName.exe /f
I try this script using installation wizard (created by winrar) and manually , in both cases i give to the script admin privilege; to prove this the service is installed successfully (it require administration privilege, so the script has these privileges as expected) but the registry is not affected if the script is launched by the wizard.
Can anybody explain to me what is happening ?
Thanks in advance (and sorry for my poor english)