PowerShell Test-Path Command
hi,
i having problems test-path cmdlet
i have created 2 variables username , password , creating pscredential object
$credentials = new-object -typename system.management.automation.pscredential -argumentlist $username, $password
$fullremotepath= "\\$server\c:\program files\redstor online backup plus"
then passing these arguments test-path cmdlet
test-path -path $fullremotepath -credential $credentials
i getting following error:
test-path : cannot retrieve dynamic parameters cmdlet. provider not support use of credential
s. perform operation again without specifying credentials.
at c:\users\binyamin.k\documents\power_shell_programs\mytest.ps1:35 char:10
+ test-path <<<< -path $fullremotepath -credential $credentials
+ categoryinfo : invalidargument: (:) [test-path], parameterbindingexception
+ fullyqualifiederrorid : getdynamicparametersexception,microsoft.powershell.commands.testpathcommand
can please me on this? have tried use invoke-command got following error
connecting remote server failed following error message : winrm client cannot process
the request. default authentication may used ip address under following conditions: transport ht
tps or destination in trustedhosts list, , explicit credentials provided. use winrm.cmd configure
trustedhosts. note computers in trustedhosts list might not authenticated. more information on how
set trustedhosts run following command: winrm config. more information, see about_remote_troubleshoot
ing topic.
+ categoryinfo : openerror: (:) [], psremotingtransportexception
+ fullyqualifiederrorid : pssessionstatebroken
regards
your remote path incorrect. should be:
"\\$server\c$\program files\redstor online backup plus"
grant ward, a.k.a. bigteddy
Windows Server > Windows PowerShell
Comments
Post a Comment