无法使用 windows powershell 远程 windows 服务器 Azure VM 运行 上的任何程序,无错误
Can not run any program on windows server Azure VM with windows powershell remote, No error
我想 运行 使用 windows powershell 远程从 windows 机器远程 运行 Azure windows 服务器上的一些程序。它已配置好,我可以执行复制、删除、添加和获取进程等操作。但我不能 运行 远程 Azure VM 上的任何程序,例如 .cmd 、 .txt 等。我没有收到任何错误。
我尝试了 Invoke-item、Invoke-process、... 来执行。如果你能帮助我,我将不胜感激。
Br,
据我所知,我们不能使用invoke-item
在powershell远程会话中打开文件。
当我们运行Invoke-Item "c:\test1.txt"
时,我们无法在powershell会话中打开这个txt文件(没有交互),但是这个进程运行在后台,我们可以使用 gps
来获取它,如下所示:
根据你的描述,我们可以运行.cmd
在Powershell远程会话中,像这样:
PS C:\Users\Administrator> Enter-PSSession -ComputerName 40.71.248.64 -Credential jason
[40.71.248.64]: PS C:\Users\jason\Documents> cd c:\
[40.71.248.64]: PS C:\> .\test.cmd
C:\>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : jason
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : ym3volvuiu2uvkfm320g2dyokd.bx.internal.cloudapp.net
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : ym3volvuiu2uvkfm320g2dyokd.bx.internal.cloudapp.net
Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter
Physical Address. . . . . . . . . : 00-0D-3A-19-04-EA
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::9c7d:4c97:bcfc:2914%18(Preferred)
IPv4 Address. . . . . . . . . . . : 10.0.0.4(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Wednesday, June 28, 2017 12:12:27 AM
Lease Expires . . . . . . . . . . : Saturday, August 4, 2153 2:19:12 PM
Default Gateway . . . . . . . . . : 10.0.0.1
DHCP Server . . . . . . . . . . . : 168.63.129.16
DHCPv6 IAID . . . . . . . . . . . : 301993274
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-20-E4-AC-C2-00-0D-3A-19-04-EA
DNS Servers . . . . . . . . . . . : 168.63.129.16
NetBIOS over Tcpip. . . . . . . . : Enabled
我想 运行 使用 windows powershell 远程从 windows 机器远程 运行 Azure windows 服务器上的一些程序。它已配置好,我可以执行复制、删除、添加和获取进程等操作。但我不能 运行 远程 Azure VM 上的任何程序,例如 .cmd 、 .txt 等。我没有收到任何错误。
我尝试了 Invoke-item、Invoke-process、... 来执行。如果你能帮助我,我将不胜感激。
Br,
据我所知,我们不能使用invoke-item
在powershell远程会话中打开文件。
当我们运行Invoke-Item "c:\test1.txt"
时,我们无法在powershell会话中打开这个txt文件(没有交互),但是这个进程运行在后台,我们可以使用 gps
来获取它,如下所示:
根据你的描述,我们可以运行.cmd
在Powershell远程会话中,像这样:
PS C:\Users\Administrator> Enter-PSSession -ComputerName 40.71.248.64 -Credential jason
[40.71.248.64]: PS C:\Users\jason\Documents> cd c:\
[40.71.248.64]: PS C:\> .\test.cmd
C:\>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : jason
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : ym3volvuiu2uvkfm320g2dyokd.bx.internal.cloudapp.net
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : ym3volvuiu2uvkfm320g2dyokd.bx.internal.cloudapp.net
Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter
Physical Address. . . . . . . . . : 00-0D-3A-19-04-EA
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::9c7d:4c97:bcfc:2914%18(Preferred)
IPv4 Address. . . . . . . . . . . : 10.0.0.4(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Wednesday, June 28, 2017 12:12:27 AM
Lease Expires . . . . . . . . . . : Saturday, August 4, 2153 2:19:12 PM
Default Gateway . . . . . . . . . : 10.0.0.1
DHCP Server . . . . . . . . . . . : 168.63.129.16
DHCPv6 IAID . . . . . . . . . . . : 301993274
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-20-E4-AC-C2-00-0D-3A-19-04-EA
DNS Servers . . . . . . . . . . . : 168.63.129.16
NetBIOS over Tcpip. . . . . . . . : Enabled