|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Remote run Script issue
Trying to run a simple utility to change the drive letter of the CD ROM. The script runs fine when running locallly. However if I try and run it remotely by changing the strComputer name I get an Access Denied message. This happens on the .Put_ line. Ideas? I think it is something in Group Policy as I've removed the machine from the domain and it then works. strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colDisks = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk Where DriveType='5'") For Each objDisk In colDisks cdrom = objDisk.DeviceID Next Set colVolumes = objWMIService.ExecQuery ("Select * from Win32_Volume") For Each objVolume In colVolumes If objVolume.DriveLetter = cdrom Then objVolume.DriveLetter = "Z:" objVolume.Put_ End If Next bobgfish wrote:
> Trying to run a simple utility to change the drive letter of the CD ROM. Probably your impersonation string. Try this:> The script runs fine when running locallly. However if I try and run it > remotely by changing the strComputer name I get an Access Denied message. > This happens on the .Put_ line. Ideas? I think it is something in Group > Policy as I've removed the machine from the domain and it then works. > > strComputer = "." > > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") impersonationLevel=impersonate,(Security)}! or perhaps: impersonationLevel=impersonate,(MachineAccount)}! or maybe even both: impersonationLevel=impersonate,(Security,MachineAccount)}! There are other privileges that you might need too. Take a look here: http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_vzbp.mspx?mfr=true -- Cheers, Chris. I actually worked out what the issue was.
Policy setting turned on. Restrict CD-ROM access to locally logged-on user only. Disbaled this policy and all worked !!! Show quote "Chris M" wrote: > bobgfish wrote: > > > Trying to run a simple utility to change the drive letter of the CD ROM. > > The script runs fine when running locallly. However if I try and run it > > remotely by changing the strComputer name I get an Access Denied message. > > This happens on the .Put_ line. Ideas? I think it is something in Group > > Policy as I've removed the machine from the domain and it then works. > > > > strComputer = "." > > > > Set objWMIService = GetObject("winmgmts:" _ > > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > > Probably your impersonation string. Try this: > > impersonationLevel=impersonate,(Security)}! > > or perhaps: > impersonationLevel=impersonate,(MachineAccount)}! > > or maybe even both: > impersonationLevel=impersonate,(Security,MachineAccount)}! > > > There are other privileges that you might need too. Take a look here: > > http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_vzbp.mspx?mfr=true > > > -- > Cheers, > > Chris. > |
|||||||||||||||||||||||