Dave: Hey Buddy,
you should look at this cool script that I found.
Buddy: Really, what
does it do?
Dave: It’s so cool. It will connect to any SQL
server and report back information about each database that is hosted on it.
Buddy: That’s cool.
Did you tell the SQL admin about it?
Dave: Yup, he said it was easier than the
expensive product we just spent 50k on. Plus he didn’t need to do anything
extra.
Buddy: I just tried
it but it keeps giving me errors.
Dave: Well do you
have SQL installed on your workstation? Greg and I do.
Buddy: No, where
can I install it from? Do I need a license? How much space does it need?
Dave: Here try running Import-RemoteCommands.ps1 –Computername
someSQLservername instead then try it
again.
Buddy: Awesome it
works now, what did that do?
Dave: The Import-RemoteCommands.ps1 script
temporarily imports all commands, functions, modules, etc. from a remote
computer to your local session so you can run almost any PowerShell script
without having to install things locally to a system.
Buddy: But what if I want to run something like that
on a server? Will I need to submit a change so the boss doesn’t have an aneurism?
Dave: You shouldn’t because as soon as you close
the PowerShell window all those commands go away! You can even use it for a
list of computers, so if you want SQL plugins, the AD module and the SCOM
module, just list all those server names separated by a coma.
Buddy: I just
opened a new console window but Import-RemoteCommands is giving me an error
now.
Dave: For it to work you need two things, 1. PowerShell
remoting needs to be enabled on the computers you list. 2. You need local admin
or PowerShell remoting access on those computers.
OK, so this didn't happen quite the way I portrayed it but it's pretty close.
No comments:
Post a Comment