SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

PowerShell Remote Commands

This is something I've found useful here recently when I had a server acting up. It's a simple way to send commands to a remote server such as 'shutdown -r'

Enable-PSRemoting -Force

Enables to you actually remote through PowerShell.

Test-WSMan Server1

Just tests that you can reach the server through this method.

Invoke-Command -ComputerName Server1 -ScriptBlock { Get-ChildItem C:\ } -credential Domain\UsrID

If you're only sending a single command, you'd replace the Get-ChildItem C:\" with what you're wanting to run.

Enter-PSSession -ComputerName Server1 -Credential Domain\UsrID

This command allows me to interact on a long term method. Basically if I'm sending more than a single command, this would work better.

I'm sure there are other methods. I like short concise code. How do you all connect?

DBA On The Go

I've been working in Enterprise IT environments for roughly 10 years. My move to become a DBA was new, but expected. I've worked in secure DoD databases and secure Pharmaceutical databases. One thing to note, the security aspect isn't a lot different. My goal is to marry Databases and security in a functional manner and see how we can speed these things up with minimal work.


Leave a comment on the original post [www.dbaonthego.com, opens in a new window]

Loading comments...