Re: Permission denied only when 2 computers are used



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
> >
> >
> >
>
>
>
.



Relevant Pages

  • Re: Windows/Macro Language Info?
    ... The point is that malware is often using Windows _features_. ... I totally understand the difference between client and server side (and you ... subverted by script code (the facilities to change file size, dates, etc. ...
    (comp.lang.cobol)
  • Re: Install printers to groups of users or computers by using Group Policy
    ... I have 4 remote offices connecting to the SBS 2003 server and I ... This is the script gotten from TechNet that I am ... Based on my research, in SBS 2003 environment, the client printer is ... computers running Windows XP pro or Windows 2000 Pro. ...
    (microsoft.public.windows.server.sbs)
  • RE: login Scripts not running
    ... The scripts were set in "Computer Cnfiguration" of GPO, ... To ensure the "Startup Script" can run normally through GPO, ... first try to run it locally on the client side to check if it works. ... is key point of that Windows 2000 clients cannot apply the startup script ...
    (microsoft.public.win2000.active_directory)
  • Re: Automatic enrollment of user certificates
    ... Jem ... >> Windows 2000 AD. ... >> user certificates on a client machine. ... This does not work for 2k computers, ...
    (microsoft.public.win2000.security)
  • RE: GPO not working after Migration
    ... I suggest you use Active Directory Users and Computers to try again. ... Open the GPO and enable the following polciy. ... | We just moved to Windows 2003 AD and we were trying to ... | implement GPO on the client machines. ...
    (microsoft.public.windows.server.migration)