Copy in win32_directory not allowing to copy for remote machine in wmi RRS feed

  • Question

  • I am trying to execute a WMI query on remote machine for getting a folder and trying to copy that folder in my local machine. 

    my $query = "Select * from Win32_Directory where Name = "."\"c:\\\\temp\\"";

    $objWMIService = $f_objSWbemLocator->ConnectServer("$device_ip", "$f_namespace", $f_domainName."\\".$f_userName, $f_password);


    $colItems = $objWMIService->ExecQuery($query,"WQL",wbemFlagReturnImmediately | wbemFlagForwardOnly);    

    foreach my $folder(in $colItems){

    my $err = $folder->Copy("\\\\\\\\RemoteServerName\\\\C\$:\\\\ABC\\\\");

    print "Err = $err";


    In $folder->Copy("\\\\\\\\localServerName\\\\C\$:\\\\ABC\\\\") Since $folder is having the handle for remote machine If I will try $folder->Copy("C:\\\\ABC\\\\") then it will copy the folder in the same machine So I have tried copying by using the localservername but it is giving me error no 9 "Path not valid". Please Help me.

    Friday, May 6, 2016 11:01 AM