From: BrunoBozic on
Hello guys,

I am new to scripting and my first task is to list folders on several remote
machines, 1 is in my local workgroup, one is outside my network (accessible
IP address), I have admin account on both.

I need to list all folders in the root of remote drive C: on both.

Whatever I do I seem to get the permission denied get object error.

Any idea?

From: Al Dunbar on


"BrunoBozic" <u65408(a)uwe> wrote in message news:af1a2d9447a0d(a)uwe...
> Hello guys,
>
> I am new to scripting and my first task is to list folders on several
> remote
> machines, 1 is in my local workgroup, one is outside my network
> (accessible
> IP address), I have admin account on both.
>
> I need to list all folders in the root of remote drive C: on both.
>
> Whatever I do I seem to get the permission denied get object error.
>
> Any idea?

Well, the first thing would be to tell us what you did that got the
permission denied error.

/Al


From: BrunoBozic via WebmasterKB.com on
Hi Al, heres some extra info on my problem:

I am using VBSEDIT as a IDE for this project.
I am using the following example script;

SCRIPT START
strComputer = "COMPUTER-A"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery("Select * from CIM_Datafile")

For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
SCRIPT END

The access denied error happens on line 2 (logging in).

There are 2 computers involved in this test, both running windows 7, both
have no firewall, both have no shared folders, both have the same
administrator account (lets call it MyAdmin/MyPassword). The computers are
not members of a domain, but are in the workgroup.

COMPUTERA throws "accesss denied" error when connecting to COMPUTER B,
COMPUTER B successfully runs the script on COMPUTERA.

Both are using "impersonate" method. By looking at the documentation,
impersonating ought not to work on a workgroup, only "identify" method. I am
left wondering why B connects to A and runs the script by impersonating.

I tried sorting this out by changing permissions for DCOM object to allow
just about everyone to run remote access and I fixed the problem
(impersonating now works both ways on a workgroup) but now I made the system
(luckily its a test system) vulnerable to intrusion.

Basically I would be most thankfull if you could give me some advice on how
to achieve the following

Task:
1) workgroup computers, 20x, same local administrator account on 10,
different one other 10
2) out of the box Win7 installations on each
3) need to run the script on all of them

(Local admin accont name: TESTADMIN/TESTPASSWORD)
(Different admin account name on 10 of computers: TADMIN/TADMIN)
(Workgroup name: TESTWORKGROUP)
(Computer names: TEST1, TEST2 ... etc.)

Problem:
1) I will need to pass (via identify) login/password for those computers,
need an example (tried and tested)
2) I dont want to change any system setting, I need it to work without
changing UAC setting/DCOM and WMI settings or making changes to existing
admin accounts)
3) script has to run on all of them and return information to the calling
computer

I am a software developer, unfortunately I am relatively network
administratin agnostic, and I know I should know how Windows handle security
over domains and over workgroups, but I never had to work with it in the past,
my latest task is to make scripts in vbscript for administrators and I am
doing my best but... ;)

--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/vbscript/201010/1