Can I use DHCP PowerShell cmdlets from a Windows 10 desktop? I have searched online a lot but only come up with results about using the cmdlets from the server. If my PC is on the DHCP server I would think there is a way to use the cmdlets from my PC. I am looking to get information about the IP addresses that are currently in use or available, etc.
Yes, you can. You have to install RSAT for Windows 10 and then make sure the DHCP tools part of RSAT is enabled.
Note that you will have to specify the DHCP server in the -ComputerName parameter of each call, or create a CIM session and use that.
Related
Here is another variation on the popular subject: PowerShell remoting. I have a system with a number of VMs hosted on a Hyper-V server. I have a need to launch programs on them remotely. I succeeded in doing this from the very Hyper-V host (I believe Microsoft calls this PowerShell Direct). I run
Invoke-Command -VMName MyVM -ScriptBlock {Mybatfile.bat}
which successfully logs into MyVM using the credentials of the current Hyper-V host login and spawns there MybatFile.bat with administrative privileges.
Unfortunately, I expect my system to be transitioned to a VMWare vSphere host, and such option will no longer be available. I hope to learn how to run Invoke-Command from one of the VMs. I understand that this may require some prep work on both the VM I am logged into and the target VM. All the VMs have an administrator account with identical credentials.
What makes this a bit more tricky is several of my VM share the same system name (reported e.g. in the properties of "This PC" as "Device Name"). They have unique VM names as they appear in the Hyper-V manager, and will have unique VMWare names. Ideally I want to keep it that way, and address the target VM by a static private IP of its virtual network adapter, or perhaps by some unique VM ID that will continue to be available on VMWare vSphere.
Thank you in advance.
I am looking to determine if a remote computer is Windows, Mac or Linux by computer name or I can resolve IP if that helps?
I have tried using TTL but it seems PowerShell 7 test-connection doesn't have TTL. I then downgraded PowerShell and played around with TTL and related but was hoping for a better method?
I am aware of the $isWindows, $isLinux, and $isMacOS but not sure how to call them on a remote computer.
I'm using Windows 8.1. and I'm trying to execute commands on another Windows 8.1. by using PowerShell (enter-pssession or invoke-command). I usually have two types of error messages : one telling me that the access is denied and another one telling me that my Firewall does not allow an HTTPS exception. None of the computers is a server. I have already tried executing Set-PSSessionConfiguration -ShowSecurityDescriptorUI -Name Microsoft.PowerShell without any result whatsoever.
I have already tried de-activating my firewall and have already added other computers to my list of trusted hosts.
I always put an IP address after enter-pssession. Could this be the source of the problem?
Thanks in advance :)
P.S. Both computers have winrm, IIS and Apache.
All you need to get started with remoting is available in the help:
PS> Get-Help about_Remote_TroubleShooting -ShowWindow
If you're not in a domain, take a look at this section:
HOW TO CONNECT REMOTELY FROM A WORKGROUP-BASED COMPUTER
-------------------------------------------------------
[..]
When the local computer is not in a domain, the following procedure is required
for remoting.
1. Configure the computer for HTTPS transport or add the names of the
remote computers to the TrustedHosts list on the local computer.
[..]
I have a HyperV server with over 10 VMs hosted on it. They all use a base image so they are not connected to a domain nor do they have there NIC configured. Is there a way that I could run commands from the host to configure the VMs NIC and join the domain as if I was actually logged in?
This is easily done if I just pop open the VM from HyperV:
###Joining domain###
$domain = "mydomain.gbl"
$cred = get-credential mydomain\defaultuser
Add-Computer -DomainName $domain -Credential $cred
Now this approach is ok if I had only a few machines but since I have so many and even more machines to come that need configuration, I am trying to find a way to automate these tasks.
Maybe I could create a scheduled task on the VMs from the host?
Since you're running Server 2008 your only option (AFAICS) would be to configure the network interfaces of the VMs with static MAC addresses (e.g. with the PowerShell Management Library for Hyper-V), set up a DHCP to provide the VMs with IP addresses. After that you should be able to do something e.g. with PsExec if the Windows Firewall is disabled on the VMs. If it isn't, you'll have to log in manually. You need at least some basic configuration for remote management.
I have three windows 2008 R2 servers; DEV, UAT and Live. I am deploying web apps between these servers, including IIS setup and config and database backup and restore via a PowerShell script. I use a powershell remote session.
I would like to prevent any machine, other than my deployment machine, from creating a powershell remote session on the host, even if the user is authenticated. Is this possible?
I have looked extensively through the PSRemoting documentation and can't find anything helpful.
Thanks in advance
Read the below link to better understand what needs to be done but I think you need to set the trusted host on the remote servers.
http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/02/23/remotely-managing-your-server-core-using-winrm-and-winrs.aspx
This is an excerp from the blog.
On the Windows server Core box
Run the following commands on the console of the Server Core box to lower security:
WinRM set winrm/config/service/auth #{Basic="true"}
WinRM set winrm/config/client #{TrustedHosts="<local>"}
WinRM set winrm/config/client #{TrustedHosts="RemoteHost"}
Where RemoteHost is the host you want to be able to connect to the server.
You can also use certificate-based authentication.
http://blogs.msdn.com/b/wmi/archive/2009/03/23/how-to-use-wsman-config-provider-for-certificate-authentication.aspx
If you only want your computer to be able to connect, install the certificate on your computer and don't give it to anyone else.