开发者

PowerShell: how to run script on a remote server?

I have a script:

$StartDay = (Get-Date).AddDays(-2)
Get-EventLog -LogName application -EntryType Error, Warning -After 开发者_如何学编程$StartDay

which I would like to run from my computer (Win XP, PowerShell 1.0) on a Server1 and Server2 (Win 2008, PowerShell 2.0). How can I run this command on these servers?


You must have administrative credentials on remote computer .

$StartDay = (Get-Date).AddDays(-2)
Get-EventLog -LogName application -EntryType Error, Warning -After $StartDay -computername REMOTESERVERNAME


In order to user PowerShell remoting you need PowerShell 2.0 installed both on the server and on the client.

Check out these links. They are a good start into PowerShell remoting:

  • Remoting with PowerShell QuickStart

  • Windows PowerShell Remoting

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜