Not able to access shared location on Remote Server

I am new to power-shell and getting one problem. 

My problem is :- I have to get the folders/files from shared location to local machine (Machine 1). I have written this script in power-shell file and placed this file on another machine (Machine 1). Now when I am trying to execute this power-shell file from my machine (Machine 2) by using credentials, but it says that "Access is denied" while accessing the shared location. 

It's working fine if I directly executes the power-shell file on (Machine 1). Following is the script that I am trying to execute from Machine 2 :-

        

[cmdletBinding(SupportsShouldProcess=$true,ConfirmImpact="High")] 
param
(
    [parameter(Mandatory=$true,ValueFromPipeline=$true)] 
    [string]$ComputerName,

    [parameter(Mandatory=$false)] 
    [System.Management.Automation.PSCredential]$Credential
)
begin
{
    if (!($Credential))
    {
        # Prompt for crede;ntials if not passed in
        $Credential = get-credential 
    }
     Invoke-Command -ComputerName $computerName -Credential $credential -ScriptBlock {

        F:\Untitled2.ps1
        }
}

Following is the script that I am trying to execute from Machine 1

robocopy [shared location] [local machine folder] /MIR /COPY:DT /FFT

Is this a admin-right issue or some thing else I have to mention in script. Please help me out from this issue.

Thanks in Advance !!

Prateek


September 6th, 2013 4:11am

this might be a double hop issue, can be resolved

http://blogs.msdn.com/b/clustering/archive/2009/06/25/9803001.aspx

Free Windows Admin Tool Kit Click here and download it now
September 6th, 2013 8:12am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics