Reputation: 591
i'm new in power shell
i need to do few operations using c# on remote machine:
i have only ip address of remote machine and port (not default 5985) to power shell connection; machine doesn't have public name and doestn't have 139,445 ports shared
i think a good idea to use File.Exists, File.Copy, ... so i tried to mount
New-PsDrive -Root 80.240.xxx.xxx:yyyy -credential User -Name X -PSProvider filesystem
error: Корень диска "80.240.xxx.xxx:yyyy" не существует или не является папкой. (Root of disk "80.240.xxx.xxx:yyyy" doesnt exists or not a folder)
can somebody help me with an example?
thanks for help
Upvotes: 0
Views: 407
Reputation: 200463
Quoting from Get-Help New-PSDrive
:
-Root <String>
Specifies the data store location to which a Windows PowerShell drive is mapped.
For example, specify a network share (such as \\Server01\Public), a local directory (such as C:\Program Files), or a registry key (such as HKLM:\Software\Microsoft).
The argument of the parameter -Root
must have the form \\hostname\share
or \\ip_address\share
. No port specification with either hostname or IP address is allowed. The cmdlet requires access to port 445 on the remote host.
You probably need to set up a VPN between the two hosts, to make this work.
Upvotes: 1