PS1无法在远程计算机上运行 [英] PS1 is not working on remote machine

查看:79
本文介绍了PS1无法在远程计算机上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是poweshell的新手,我在本地PC上运行这个已修改的脚本文件,但无法使用远程调用。 (通过GPO启用Powershell远程处理)

I am new to poweshell, I have this modified script running file on local PC but cannot use remote call . (Powershell remoting is enabled via GPO )

脚本在本地主机icm上正常运行  ; -computername PClocal {c:\ pdder1 \test.ps1}

The script running fine at local host icm  -computername PClocal {c:\folder1\test.ps1}

但是不使用远程PC并且使用下面的cmdlet没有错误:

but not working on remote PCs and no error by using the cmdlet below:

icm -computername pc1 -scriptblock {c; \ pdder1 \test.ps1}

icm -computername pc1 -scriptblock {c;\folder1\test.ps1}




完全没有错误但只是没有安装软件。我认为要么缺少花括号等等。

No error at all but just didn't install the software. I think either missing curly bracket or something.

所有文件都被推送到本地C: \ pdder1通过GPO。我可以看到它们,但脚本只是不会接受它们。它适用于我的本地PC。  

All files are pushed to local C:\folder1 via GPO. I can see them but script  just won't pick them up. It works on my local PC.  

我可以在下面使用这个,这会导致循环,我我不知道该放什么。

Can I use this one below, which  cause a loop, I am not sure what to put in there.

 

$ exe = @('setup.exe','SW_Win7_64Bit.exe')

$exe = @('setup.exe','SW_Win7_64Bit.exe')

$ msi = @('Service.Installer_Win7')

$msi = @('Service.Installer_Win7')

 

  foreach($ exe文件在$ exe中) 

 foreach ($exefile in $exe) 

{start-process -FilePath" c:\ folder1 \setup \ setup.exe" / s 

{start-process -FilePath "c:\folder1\setup\setup.exe" /s 

  start-process -FilePath" c:\ folder1 \software9000.exe" -ArgumentList" / qn" -Wait

 start-process -FilePath "c:\folder1\software9000.exe" -ArgumentList "/qn" -Wait

  Start-Process -FilePath" c:\ folder \\ \\Service.Installer_Win7.msi" -ArgumentList" / qn" -Wait 

 Start-Process -FilePath "c:\folder\Service.Installer_Win7.msi" -ArgumentList "/qn" -Wait 

}

write-host $ file_path

write-host $file_path

推荐答案

什么如果你这样做会发生吗?

What happens if you do this?

Invoke-Command -Computername RemotePC -ScriptBlock 
{Start-process "C:\SW_Win7_64Bit.exe" -argumentlist /s}




假设你的


Assuming your

SW_Win7_64Bit.exe


文件位于C:\ drive

file is in C:\ drive


这篇关于PS1无法在远程计算机上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆