Get OS from Remote Computer (Powershell) - powershell

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.

Related

Connecting MAAS to VMWare Workstation machines

I'm trying to connect my MAAS version: 2.4.2 to my VMWare Workstation 15.0 so that it will retrieve the machines from VMWare Workstation. I have read earlier questions and answers and saw that the Workstation machines need to be in the 'Shared Folder' so I did that. I also enabled sharing in VMWare Workstation. I checked my firewall and network connection. I am able to telnet to my Workstation machine on port 443 and I get a connection, but when I try to add the "chassis" in MAAS it doesn't give me any response. When I try to edit the power configuration of one of the existing machines and add my credentials it gives me an SSL error:
Can somebody point me in the right direction?
I found the answer. I asked for a solution on the MAAS forums and you can try two things:
Try to import the SSL certificate yourself.
Add 'https+unverified' to the field VMWare API Protocol (optional).
The second solution fixed the problem for me and I can now power on/off the machines from MAAS. Super!

DHCP PowerShell cmdlets from PC

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.

PowerShell enter-pssession

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.
[..]

How can I debug Windows in one VM from another VM using VirtualBox?

I am working on some start-up (pre-logon) code for Windows 7, and would like to be able to debug it (if only to see how it really works, as Microsoft's documentation is terrible).
My environment is VirtualBox on a Linux host, with three Windows VMs (a Windows 2008 domain controller, a Windows 7 dev machine, and a Windows 7 test machine), and I'd like to be able to debug the startup process of the test machine remotely from the dev machine using a virtual serial connection two virtual machines.
[I have, in another life, debugged Linux kernel drivers in one linux VM from another using VMware workstation on a Windows host so I know that this sort of thing is potentially doable.]
I've seen people using windbg to debug Windows in a VirtualBox VM from the host, but I need to do it from a second guest (because my host is non-Windows). Has anyone figured out how to do that?
Edit:
I had tried the obvious approach before I posted. I created a virtual serial port in each VM configuration and attached them both to the same host pipe, to be created by the dev VM (debugger) and used by the test VM (debugee). I then ran
bcdedit /dbgsettings serial debugport:1 baudrate:115200
bcdedit /debug {current} on
in the test VM and shut it down. Ran windbg in the dev VM selected kernel debugging (on the correct serial port) and restarted the test VM. Some messages appeared about not having any symbols available and the test VM hung.
I have since found this article: http://www.benjaminhumphrey.co.uk/remote-kernel-debugging-windbg-virtualbox/ which (although that guy is using a Windows host) seems to describe exactly the method I'd tried, but his test VM doesn't hang. The output I get in the wndbg window is the same as his, but stops before the line staring "Windows XP Kernel ..."
I'm now less sure that this problem is related to VirtualBox and more unsure as to whether I'm using windbg correctly. Any help would be appreciated.
Another Edit I have tried attaching the virtual serial port of the Test VM to a host file, and I get some debugging output in the file. I have tried setting the virtual serial ports of the two VMs to point to a host pipe and running a terminal (rather than WinDbg) in the Dev VM, and I get debugging information in the terminal.
I think I've now determined that this is definitely a problem with WinDbg rather than VirtualBox (I'll remove the virtualbox tag and replace it with windbg) but I'm not sure why WinDbg isn't talking.
More information:
I've just upgrade Upgrading to VirtualBox 4.2.4 (not sure whether the version matters) and have looked at this again.
I rebuilt the test VM and was more patient!
It now seems that the test VM is running - and I do eventually get some output in the windbg window - but it takes about 15 minutes for the debuggee OS to boot! This is clearly not useful for day-to-day kernel debugging. I have no idea why this should be so slow ... there is no perceptible slowdown if I run a simple terminal in the dev VM instead of windbg (though, of course, the debug information is then mostly garbage).
Any ideas?
I realize this is one helluva necro, but...
Have you tried setting up the debugee for kernel-mode network debugging? I'm thinking that the slowdown is in a large part because serial is so g.d. slow.
http://msdn.microsoft.com/en-us/library/windows/hardware/hh439346%28v=vs.85%29.aspx
If/when M$ decides to rot away that link, these parts of above article are what you need to do to get this set up:
Setting Up the Target Computer
To set up the target computer, follow these steps:
Verify that the target computer has a supported network adapter.
Connect the supported adapter to a network hub or switch using standard CAT5 or better network cable. Do not use a crossover cable, and do not use a crossover port in your hub or switch.
In an elevated Command Prompt window, enter the following commands, where w.x.y.z is the IP address of the host computer, and n is a port number of your choice:
bcdedit /debug on
bcdedit /dbgsettings net hostip:w.x.y.z port:n
bcdedit will display an automatically generated key. Copy the key and store it on a removable storage device like a USB flash drive. You will need the key when you start a debugging session on the host computer.
Note We strongly recommend that you use an automatically generated key. However, you can create your own key as described later in the Creating Your Own Key section.
If there is more than one network adapter in the target computer, use Device Manager to determine the PCI bus, device, and function numbers for the adapter you want to use for debugging. Then in an elevated Command Prompt window, enter the following command, where b, d, and f are the bus number, device number, and function number of the adapter:
bcdedit /set "{dbgsettings}" busparams b.d.f
Reboot the target computer.
And to connect to it, use the following steps:
Using WinDbg
On the host computer, open WinDbg. On the File menu, choose Kernel Debug. In the Kernel Debugging dialog box, open the Net tab. Enter your port number and key. Click OK.
You can also start a session with WinDbg by opening a Command Prompt window and entering the following command, where n is your port number and Key is the key that was automatically generated by bcdedit when you set up the target computer:
windbg -k net:port=n,key=Key
If you are prompted about allowing WinDbg to access the port through the firewall, allow WinDbg to access the port for all the different network types.
Using KD
On the host computer, open a Command Prompt window. Enter the following command, where n is your port number and Key is the key that was automatically generated by bcdedit when you set up the target computer:
kd -k net:port=n,key=Key
If you are prompted about allowing KD to access the port through the firewall, allow KD to access the port for all the different network types.

how to access IIS on VMware using PC name not IP

I have a mac running Lion OS, and Windows 7 Ultimate installed on VMware Fusion
on my Windows machine, I have IIS running and I can access it from my mac browser using the IP address such as:
http://192.168.0.10
I am developing an iPhone app on xcode and connecting to IIS as a server to access MS Server DB for testing.
my problem is that I use my mac on many networks such as Work, Home, MiFi and others
every time I change the network the IP changes and every time I need to access IIS I need to update my server IP in my app.
even on my home netwrok or MiFi the IP is the same every time I connect (Dynamic)
I am thinking to access the IIS using the PC name on my windows 7 machine like this:
http://mypcname
to make easier to test without editing the IP every time.
Can anyone guide me how to do that? I did search around many sites and forums to figure it out with no success, maybe I am missing something.
Thanks in advance.