Tag Archives: firewall

How to check my CPU Temperature using PowerShell Remotely

Thought it would be helpful to share how to remotely check your Computer temperature especially when you have a computer at home and you want to track if it is HOT. Just in case you don’t want to burn your computer etc etc, for whatsoever reason.

Well. Steps below show you how to do that! Make sure your client machine (the one that you are using) has PowerShell version 2.0 and above (well most of the Windows nowadays has it already). Just do a Search in your program menu and you should see it

  1. First of all, ensure your target computer (the one sitting at home that you want to check) has Firewall Turn off (not recommended). Alternatively, set Exception rules for WMI rules.
    Very briefly, go to “wf.msc” – Windows Firewall of the target computer and enable Inbound Rules for “Windows Management Instrumentation (WMI-In)” – Profile: Domain.
    remotely check cpu temperature - 1
    See detail steps here 
  2. Once firewall is cleared, make sure you have local administrator rights account that can query the CPU temperature in the target computer. (this one is simple) Fire “lusrmgr.msc” in the Run command.
    Check the “Administrators” group and make sure your account is the member.
  3. In order for you to be able to remotely check your computer temperature, you must have connectivity to your target computer. I believe there could have many way you can have connectivity to your target computer. Of what I know, the below three should be enough to fulfill the task
    1. One that I always like to use is Teamviewer. With this, you can easily establish VPN or remotely login to run the script mention in Step 4. (without specifying the -Computer and -Credential).
      Make sure when you install the Teamviewer, you have the VPN Driver installation option ticked.
    2. Allowing RDP to your target computer from public IP. In this option, you need to configure your Home Router to allow port 3389 to hit your target computer. Please go to your router admin page (usually ends of 192.168.0.1 or  192.168.1.1 depending on which is your subnet) and configure port forwarding to your private IP.
      In this way, you will be doing the same steps as option 1 where the only difference is you remotely accessing your home computer and run the script directly onto the target computer. Again, without specifying the -Computer and -Credential parameter in step 4)
    3. Option 3 is kinda most complete one and if you want to learn a little bit deeper for WMI. In this option, you will be granting DCOM port (135) and a fixed port (24158) port forwarding to your remote compute (which is accessible via public IP like what you’ve done in option 2). Refer here for how to fix WMI port.Screen shot example on how I configured the WMI to fixed port. (please pardon the typo)
      configure WMI to fixed port
      At the end of the day, your target computer but be accessible via DCOM port and WMI port from public IP.
  4. Open PowerShell via Administrator rights and run the following PS command

    Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace “root/wmi” -ComputerName “<IP of your target computer>” -Credential (Get-Credential)

    You will be prompted to specify the credential, use the account that you have administrator rights mentioned in step 2 above.
  5. You should be expecting response like screen below
    remotely check cpu temperature - 3
  6. Look for “CurrentTemperature” and the value is in Celsius

How to enable Remote Desktop for your Computer/Server

To most of the IT guys out there, I believe this is quite a common thing that you may have bumped into this and believe me, sometimes you thought you have done it right and still did not able to get it working.

Let me note that all the steps that you need to do in order to allow RDP to your Server (from some machine within the same Network).

Most people already know the step 1 and 2. What’s lacking here that you may not know is the step 3 (Fire Wall!)

FIRE~~~~ Wall FIRE~~~~ Wall

Photo credits to www.clker.com

Step 1: Allow remote connections to this computer and grant login for RDP

  1. Open RUN and enter “sysdm.cpl” and click “Remote” tabs.
    Alternatively, go to Explorer (Windows + E), right click anywhere, select Properties and click “Remote Settings” on the left panel.
  2. You should see System properties panel as shown below.
    remote desktop allow remote connections
  3. Check “Allow remote connections to this computer“.  Refer to here for option “Allow connections only from computers running Remote Desktop with Network Level Authentication (recommended)”
  4. Click “Select Users” and add in any users that you want to allow remote connection. If it is for your own usage, you may just leave this empty. In scenario where you need to allow multiple users to access your computer using different account, you need to create local user and add them here. In a even more common scenario where your computer/server is joined to a domain, you can add in the domain users account here for remote access.

Step 2: Security Policy

  1. At times, your server may need to join to a domain. Some domain policy may have configure the security policy to harden all domain servers. In this case, please check your local security policy and see if the Allow log on through Remote Desktop Services has included the login that you are gonna use. For simplicity, unless otherwise, use Administrator group of users which by default, granted permission to RDP.
  2. To check, open RUN and fire “secpol.msc
  3. Navigate the left panel to “Security Settings” > “Local Policies” > “User Rights Assignment”
  4. Look for “Allow log on through Remote Desktop Services” and see if your remote login is in this value. If not, “Please contact your server administrator” lol!

 

Step 3: Firewall!

  1. Open RUN and enter “wf.msc” (shortcut to Windows Firewall).
  2. Click “Inbound Rules” from the left panel
  3. Look for “Remote Desktop – User Mode (TCP-In)” and “Remote Desktop – User Mode (UDP-In)” and make sure they are both enabled. If not, please right click and hit “Enable Rule”

 

Once the steps above are done, open Remote Desktop Connection program (or “mstsc” in RUN), specify the computer/server IP and start RDP!