Re: Script retuning error on remote machine



Victory!!!
Kinda.
Ok, i found out an interesting fact about WMI. the command is running on a
remote system, and so it is tryin gto save the files on the remote system,
and the c:\scripts\ directory did not exist on the remote system. I created
it, and all went well.

But this causes a new problem, I tried this;
errBackupLog = objLogFile.BackupEventLog("\\LOCAL_SERVER\c$\" &
strBackupName & "_" & objLogfile.LogFileName)

But it did not like the network FQDN.

Am I writing this wrong?
or
How can a VBScript copy the files off the remote system to a central location?

"Richard Mueller [MVP]" wrote:


"blankmonkey" <loftyworm@xxxxxxxxxxx> wrote in message
news:581f097ac984484c9bfa4c000b39d67e@xxxxxxxxxxxxxx
I have the following script. I works fine for the local machine, but when
I
try to run it on a remote system, it is failing with;
NTLMLogin resulted in hr = 0x8004100e

I am completely lost, please help :(

strComputer = "REMOTE_COMPUTER"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Backup)}!\\" & _
strComputer & "\root\cimv2")

Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where LogFileName='Application'")

For Each objLogfile in colLogFiles
errBackupLog = objLogFile.BackupEventLog("c:\scripts\application.evt")
If errBackupLog <> 0 Then
Wscript.Echo "The Application event log could not be backed up."
Else
objLogFile.ClearEventLog()
End If
Next

Some time ago I researched how to connect to remote computers with WMI and
found the following:

1. You cannot connect to computers running XP Home.
2. An NT computer cannot connect to OS later than W2k.
3. A W2k3 computer cannot connect to Win9x.
4. To connect to W2k Server SP4 you must set impersonation level to
Impersonate.
5. W2k computers must have SP2 to connect to XP or above.
6. W2k3 can only connect to Win9x and NT if credentials supplied.
7. To connect to XP or W2k3 you must set authentication level to Pkt.

I determined this before Vista came out, so I need to add to the list.

For best compatibility I specify authenticationLevel, as in:

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")

Also, WMI can become corrupt. It can also be blocked by a firewall or DCOM
can be disabled. Sometimes stopping and starting the WMI service helps.
Otherwise, see these links on troubleshooting WMI:

http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx


http://support.microsoft.com/kb/875605

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--



.



Relevant Pages

  • Re: Script retuning error on remote machine
    ... try to run it on a remote system, ... You cannot connect to computers running XP Home. ... W2k3 can only connect to Win9x and NT if credentials supplied. ... Also, WMI can become corrupt. ...
    (microsoft.public.scripting.vbscript)
  • Re: Install remote software in asp.net
    ... it is possible to run WMI with ASP.NET. ... It is less a problem to do this to remote system as to the local. ... >>> Public Sub Install(ByVal strMsiPath As String, ByVal strHost As String, ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Cant connect to remote computer.
    ... the Local Administrator account on the remote system. ... I first do a WMI check to make sure I can connect remotely, ... MsgBox myMsg, VBCritical, "WMI Connection Error!" ... Dim objWMIService ...
    (microsoft.public.scripting.wsh)
  • Re: Read a file from a local/remote computer
    ... You can not "read" a file using WMI but you can get a CIM_DataFile object and work with it's properties and methods. ... you can use this to test against your own machines both local and remote - if this works, converting it to C++ is easy. ... return oFile; ... I login to the remote system using admin powers and I know the path ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Disk Quotas & COM interface
    ... either need WMI or an agent you write running on the remote system that performs the functions like WMI does. ... Petr Reichl wrote: ... I would like try access over COM interfaces. ...
    (microsoft.public.win32.programmer.wmi)

Quantcast