i trying access shared drive vai remote server in powershell script. code below:
$bypass1 = "config" $bypass2 = "web.config" $username = "test\newtest" $password = "xxxxxxxxx" $srv = "xxx.xxx.xxx.xxx" $securepassword = convertto-securestring -asplaintext -force $password $cred = new-object system.management.automation.pscredential $username, $securepassword $session = new-pssession -computername $srv -port 22 -credential $cred invoke-command -session $session -scriptblock { $computer = "xxx.xxx.xxx.xxx" test-path \\$computer\netlog\php get-childitem \\$computer\netlog\ } remove-pssession -session $session
when tried access shared remote desktop connection on server working through powershell throwing following error.
false cannot find path '\\xxx.xxx.xxx.xxx\netlog\' because not exist. + categoryinfo : objectnotfound: (\\xxx.xxx.xxx.xxx\netlog\:string) [get-ch ilditem], itemnotfoundexception + fullyqualifiederrorid : pathnotfound,microsoft.powershell.commands.getchilditemcom mand + pscomputername : xxx.xxx.xxx.xxx
i having powershell 4 , remote server windows 2008 r2.
regards, vj
did try accessing following path \\xxx.xxx.xxx.xxx\netlog\
locally? have creds access server. , drive shared. try accessing path locally. not via power-shell. try old fashioned way. using run
. if prompted credentials entered. may strike off issues related permissions. if not... folder trying access isn't shared @ all. try giving required permissions. if isn't case please leave comment.
Comments
Post a Comment