Re: Permission denied only when 2 computers are used
- From: "savvy95" <savvy95@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Jan 2006 12:21:01 -0800
Thank you for reply. Your suggestions, although good do not apply in my
situation as all the client are either Windows 2000 or better; by Group
Policy have the Firewall off and DCOM is started by default.
I did receive some assistance, but not answer to my problem that I should
close the file (oFile). This seems the most likely, but I can't get it to
work.
"Richard Mueller" wrote:
> Hi,
>
> To use WMI, both computers need WMI installed. Any PC with Windows 2000 or
> above has WMI, but it must be installed on older clients. Also DCOM must not
> be disabled, and you need administrator privileges on the remote machine.
> And, perhaps there are firewall issues.
>
> --
> Richard
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
>
> > When I run this script using 1 remote computer name, it works. When I add
> > another computername, I get "Permission Denied". Can anyone help me?
> > ================
> >
> > Option Explicit
> > Dim strComputer, oFile, oFS, arrComputers, objWMIService, colItems,
> > objItem
> > Dim username, password
> > Const wbemFlagReturnImmediately = &h10, wbemFlagForwardOnly = &h20
> > Const ForReading=1, ForWriting=2, ForAppending=8
> >
> >
> > Set oFS = CreateObject("Scripting.FileSystemObject")
> > 'Set strFile = "c:\Scripts\ComputerApps.txt"
> >
> > 'if I take away one computername the script runs fine
> > arrComputers = Array("nea010","nea014")
> >
> > For Each strComputer in arrComputers
> >
> > Set objWMIService =
> > GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & strComputer &
> > "\root\CIMV2")
> > Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product",
> > "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
> >
> > Set oFile =
> > oFS.OpenTextFile("c:\Scripts\ComputerApps.txt",ForAppending,FALSE)
> > 'oFile.WriteLine "Computer Name; Insert Date;SubKey;Display name;Display
> > version;Install location;Install Date;Publisher"
> >
> > For Each objItem In colItems
> > oFile.Writeline strComputer & ";" & Date & " " & Time & ";" &
> > objItem.IdentifyingNumber _
> > & ";" & objItem.Description & ";" & objItem.Version & ";" &
> > objItem.PackageCache _
> > & ";" & objItem.InstallDate & ";" & objItem.Vendor & "; WMI"
> > Next
> > Next
> >
> >
> > Function WMIDateStringToDate(dtmDate)
> > WScript.Echo dtm:
> > WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
> > Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
> > & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" &
> > Mid(dtmDate,13, 2))
> > End Function
> >
> >
> >
>
>
>
.
- Follow-Ups:
- Re: Permission denied only when 2 computers are used
- From: Richard Mueller
- Re: Permission denied only when 2 computers are used
- References:
- Permission denied only when 2 computers are used
- From: savvy95
- Re: Permission denied only when 2 computers are used
- From: Richard Mueller
- Permission denied only when 2 computers are used
- Prev by Date: Re: Permission denied only when 2 computers are used
- Next by Date: Help with script found on this forum --> FTP Download
- Previous by thread: Re: Permission denied only when 2 computers are used
- Next by thread: Re: Permission denied only when 2 computers are used
- Index(es):
Relevant Pages
|