[Autogenerated] now that we've reviewed the methods of collecting
information for a local device and a review of how we will be using
the W M I module for remote collection.
Now,
let's move back into our demonstration environment and show an example of how
we can use the W M I module to collect information remotely.
And since we're deciding to use the W M I module,
obviously the remote system in this case is a Windows machine and
what we're going to be doing is using the same methods that we
showed in the previous demonstration section,
but in this case we're going to be doing it for a remote machine.
Now, as I noted in the previous section,
in order for this to work,
you need to ensure that W M I communications are allowed
from this device for this to work,
which is somewhat limiting in the potential options
for this specific implementation,
but sometimes W M I in enterprise environments is enabled by default,
so it gives it potential for using this module without having to do anything or
if you're in a specific situation where you can gain access to these remote
machines in order to enable W M I once that's enabled,
then you can run any of these different functions against it.
Now, at the beginning of this script, as a comment,
I give one of the potential URL options for where you can go,
where it describes how you can enable W M I monitoring on a Windows
machine and these scripts are included as part of the resources
that will be available for this course, as published on the Pluralsight website.
So if they start at the beginning here we are importing the W.
M.
I and the socket modules primarily we're going to be using the W.
M.
I module.
And if we look here this doesn't look exactly like it did before.
First thing we're doing is we're going to be setting a few
different variables including the target machines,
IP address the user name and password for that machine.
And then we're going to be moving inside a try and we're doing
that just in case any heirs occur and we're going to be performing
a connection like we did before this.
Um my function was included without any additional arguments
behind it but in this case we're including the I.
P.
Address and the user name and password information
that we collected at the beginning, pushing it into that connection,
variable Then from here all of these different commands going
down here are going to look almost identical to what they did in
the previous demonstration section.
So we are still collecting information using the Win 32 operating system,
a method from the W M my library.
We're still going to kick out the caption the free memory.
Total memory and so on down here.
We're going to be using the computer system one with the
number of logical and physical cores, the name of the machine.
And if I moved down here a little bit we're going to be using the same
network adapter one where we are showing the mac addresses that are assigned
each one of the interfaces that exists on that remote machine as well as the
IP address information if it is assigned.
So if we run this We should have an output that's pretty basic,
but similar to what we saw in the previous section,
so where we begin here and it looks a little bit different.
The first part of this is connecting so we have printed out,
we have established a connection with the.11 address and then from there,
all of this output that we see here is should mirror the
output that we saw whenever we were looking at it and
querying it from a local machine.
So the remote machine is also running Windows 10 professional,
it's free memory is five gig it's total memory is also a gig.
It's running the same build number multi process are free,
still running the same.
Most of these stats are exactly the same.
The computer system here,
it's lab two instead of lab 14 logical processors to physicals
and then we go into the networking stuff.
I moved down in this a little bit so we can see all of it.
So the networking stuff in this case,
that remote machine has a couple more logical network
interfaces that are enabled but the main one that we're going
to be focusing on here is the intel, one gigabit connection.
The MAC address and then that specific interface is
assigned with two different IP address is in this case the
10.10 dot 10.101 uh in 255255255.0.
And it also has an assigned IPv6 link local address.
So all of this information can be retrieved from a remote machine,
just like it could the local machine,
but you have to make sure that those different services
are enabled and allowed to be queried.
So with that,
that will complete our demonstration and the last demonstration
section we have for this specific module and then we're going to
move on into our next module where we talk about how we can use
python to interact with my SQL