Remote run Script issue



Hello

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
.



Relevant Pages

  • Re: Need Help..
    ... strComputer, strName, strModel, etc. works, then I can only guess the ... this part of the script is working. ... The part where we must add disconnected computers to the database i can't ... Dim strComputerName ' The Computer Name to be queried via WMI ...
    (microsoft.public.windows.server.scripting)
  • Re: Loop with out Do
    ... Set objLog = ... & vbNewLine & vbNewLine ... Also, strComputer will never be False, but ... When I fixed the problems in the second script, ...
    (microsoft.public.windows.server.scripting)
  • Re: VBScript and Out Put to Excel Worksheet
    ... removed them from the list and now the script works. ... Dim strComputer, strDN ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)
  • RE: This script wont run on a workgroup server
    ... Set objService = objLocator.ConnectServer(strComputer, "Root\Default", ... strUser, strPassword) ... > I have this script that I use on domain member servers and it runs just fine. ... > strPassword = objExplorer.Document.Body.All.UserPassword.Value ...
    (microsoft.public.scripting.wsh)
  • Re: Modifiy this script to read a nested "Computers" container
    ... I ran the below script and received the following error. ... There are computer accounts in both the top level OU called Site1 and ... ' input: strComputer ... Sub GetLocalAdmins ...
    (microsoft.public.scripting.wsh)