[quote=9227]Arh, Thanks, i’ll look it through.
One thing though. I dont know if you’ve seen it but, on that “jumpstart to powershell †or something like that, It’s a series of training videos to learn Powershell. Anyway – when he gets into remoting etc. he writes Things like enter-pssession -Computername <computernames>
How exactly does IT know, that when he writes dc it knows what server he’s talking about? I’ve tried with IP addresses, adding them to trustedhosts, Making sure the firewall wasn’t blocking, activating it on each end, etc. and yet i keep hitting “Access Deniedâ€
Anyway, i just wanted to know about the names, Is that ADComputer that does that?
[/quote]
I’m having a little trouble understanding you. So I will try answering what I hope are your questions.
Take for example the following command: enter-pssession -Computername DC
The computer you’re running this command from most likely will be on the same domain as the remote computer DC is on. Or, the domain the computer you’re running the command from is on a domain that trusts the domain DC is on.
The other scenario you might be talking about is if the computer you’re running the command from is in a workgroup and the remote computer, DC, is in a domain. In that case the computer you’re running the command from will not know how to find DC. To get around this you will want to tell the computer where to find the computer named DC by editing the HOST file. This file is normally found \Windows\System32\Drivers\ETC
I would recommend that you start with the help system for remoting.
Using your original command I would probably run something like this:
invoke-command -computername ‘192.168.1.1’ -credential domain\username -scriptblock {get-service}
The command above would retrieve the services on the remote computer.
In order for the example that I gave you to work, you need to meet two requirements.
-
You have to make sure that the remote computer at 192.168.1.1 is enabled for PSRemoting. There are many ways to do this and I’ll let you look those up. However, the fastest way would be for you to connect to 192.168.1.1, open a PowerShell window, and type in: enable-psremoting.
-
The remote computer and your computer trust each other. This is required because you’re using an IP address and not a Fully Qualified Domain name. For testing purposes only you can accomplish this with the following command: Set-Item WSMan:\localhost\client\trustedhosts * -Force You should look up the help for the command I just gave you along with WSMAN so you know what you’re modifying.
I hope this helps get you started.