analogy between our brains and computer

analogy between our brains and computer

Ever considered that we are, in essence, hardware? This realization hit me like a bolt of lightning. It triggered a fascinating analogy between our brains and computer systems, especially for someone deeply entrenched in Information Technology.

The Structure of the Brain: A Hardware Blueprint

Now, Imagine your hands as the keyboard and mouse. A sophisticated gaming tool with preprogrammed keys and buttons capable of intricate functions. As you type, data travels up to the PCI bus, akin to the nervous system transmitting electrical impulses between your computer and peripherals. If you disconnect the cable, and the keyboard becomes useless—much like losing the function of a hand.

Next, let’s delve into the brain’s components. First up:

Cerebellum: The Basic Processor

Much like a computer’s front side bus, the cerebellum, often referred to as the lizard or reptilian brain, handles basic input and output functions. Think of it as the system responsible for making quick decisions without conscious thought, such as pulling your hand away from a hot stove. This exemplifies the hardware-like nature of our actions.

Limbic System: The Emotional Hub

Next, data ascends to the processor for logical structuring. However, it first must go through the limbic system of our brain. In our brain, the limbic system plays this role. Here, this emotional control center processes signals from the cerebellum, turning physical sensations into emotions. The pain from touching a hot stove transforms into sadness, anger, or other emotional responses. Memories, too, find their home in various parts of the brain, adding layers to our emotional experiences.

Frontal Lobes: The Logical Processor

The thought process then reaches the frontal lobes, the brain’s logical processor. Here, cognitive processing occurs, and the prefrontal lobes manage movements and other functions. In our scenario, the prefrontal lobes analyze the pain signal, deducing that touching the hot stove hurts and should be avoided. The processed information then relays back to the limbic system, creating a memorable, emotionally charged experience.

A Unique Feature: The Limbic System

One fascinating aspect of our brain is the centrality of the limbic system. Almost all thoughts pass through this emotional control center, which also crucially contributes to memory formation. The unique feature lies in the fact that the limbic system doesn’t judge the emotions it sends; we, as individuals, impose the judgment. It’s a reminder that these signals are just that—signals.

The Enigma of the Brain

While we marvel at the complexity of our brain, acknowledging it as a magical place, there’s still much we don’t fully understand. In recent decades, groundbreaking research into the electrical signals of the brain has revealed astonishing findings.

The Human Brain—A Symphony of Signals

In our journey through this intricate system, we glimpse the harmony of hardware and emotion, a dance of impulses and reactions that shape our human experience. As we continue to unlock the mysteries of the brain, the intersection of Information Technology and mental health reveals itself as a realm of endless possibilities.

Continued Reading

Read Radius Logs With PowerShell

Read Radius Logs With PowerShell

Recently, I have been troubleshooting radius. Radius hasn’t changed in decades. I say this lightingly too. The network policy server is a feature that helps with connecting things like unifi wifi and more. Each radius connection produces a reason code. Today we want to look through the radius logs and get as much useful information without screaming at the screen. Radius logs are a little daunting. This is why many people use an SQL server for the radius logs. However, if you are not one of those people who can do this, the traditional radius logging works wonders. So, we will read radius logs with PowerShell.

Radius Logging

Before we start, we need to know what we are dealing with. The standard location for readius logs is: C:\Windows\System32\LogFiles. You can change this location as you see fit. I personally changed my locations to a c:\logs\radius location. This helps me find it quicker and generally, I don’t have trouble guessing what is what. You can set the radius log location by doing the following:

  • Start Network Policy Server
  • Click account
  • Under Log File Properties click Change Log File Properties
  • A box will pop up called “Log File Properties” Click on the “Log File” tab.
  • This is where you can change your directory.
  • Change your Format to DTS Compliant. As this script works best with it.
  • I personally like smaller files when I am working with log searches. So I select the “When log file reaches this size:” I select 1 – 5 MB.
  • Click ok

Now your log files will live wherever you told them. You will need to change the script around a little if you are using a different location than me.

The Script and Breakdown

$NPSLogs = Get-content -Path "C:\Logs\Radius\IN2308.log" | Select-Object -Last 6
foreach ($NPSLog in $NPSLogs) {
    [pscustomobject][ordered]@{
        TimeStamp = ([xml]$NPSLog).event.Timestamp.'#text'
        ComputerName = ([xml]$NPSLog).event.'Computer-Name'.'#text'
        Sources = ([xml]$NPSLog).event.'Event-Source'.'#text'
        Username = ([xml]$NPSLog).event.'User-Name'.'#text'
        CalledStationId = ([xml]$NPSLog).event.'Called-Station-Id'.'#text'
        CallingStationId = ([xml]$NPSLog).event.'Calling-Station-Id'.'#text'
        NasPortType = ([xml]$NPSLog).event.'NAS-Port-Type'.'#text'
        NasIdentifier = ([xml]$NPSLog).event.'NAS-Identifier'.'#text'
        NasPort = ([xml]$NPSLog).event.'NAS-Port'.'#text'
        ClientIPAddress = ([xml]$NPSLog).event.'Client-IP-Address'.'#text'
        ClientVendor = ([xml]$NPSLog).event.'Client-Vendor'.'#text'
        ClientFriendlyName = ([xml]$NPSLog).event.'Client-Friendly-Name'.'#text'
        ProxyPolicyName = ([xml]$NPSLog).event.'Proxy-Policy-Name'.'#text'
        ProviderType = ([xml]$NPSLog).event.'Provider-Type'.'#text'
        SamAccountName = ([xml]$NPSLog).event.'SAM-Account-Name'.'#text'
        FQUsername = ([xml]$NPSLog).event.'Fully-Qualifed-User-Name'.'#text'
        AuthType = ([xml]$NPSLog).event.'Authentication-Type'.'#text'
        Class = ([xml]$NPSLog).event.Class.'#text'
        PacketType = ([xml]$NPSLog).event.'Packet-Type'.'#text'
        ReasonCode = ([xml]$NPSLog).event.'Reason-Code'.'#text'
        TunnelClientEndpt = ([xml]$NPSLog).event.'Tunnel-Client-Endpt'.'#text'
    }
}

As you can tell, this script needs to be used on the server in question. However, You could wrap this script into a nice wrapper. That would allow you to execute on remote machines. The breakdown is very simple on this one as well. DTS is an XML format. Thus, you just need to use the [XML] before any of the lines. The XML is formatted with the event, it’s name, and the text. It’s a very simple setup. From there I select what I want and give it in a pscustom object. That’s it. Its a very simple setup. That’s why we should always read radius logs with Powershell.

Breaking Free from Potential Trauma Lensing

Breaking Free from Potential Trauma Lensing

Recently I have had to come to a new level of understanding about myself. For years I have been attracted to the potential of others. I have picked my closest friends through this viewpoint; it worked for many years. However, as we get older, things change, and people change. This view of the world no longer works. Instead, it flipped and it led to more pain than good. I wanted to break down what I call Potential Trauma Lensing for yall and maybe it will help shine a light on some of the darker places and bring understanding.

Trauma Lensing

As a child, I was sexually abused by a babysitter and other family members. My parents didn’t know how to handle such a thing and thus, I was often beaten. I will admit, I wasn’t an easy child to raise. I grew up with extreme ADHD and I was one of four. One of my survival skills during this time was to see the good more than the bad.

I choose to see my mom as a loving and caring person, which was only part of the truth at the time. The truth was, she was scared. She was hurting, angry, and oftentimes felt like she was a failure. She was also physically abusive. The lens I choose to see her through my whole life was that of a caring and loving mother. It wasn’t until after she died did I see the full picture. Let me give you an example.

When we were younger, my mother use to take her thumbnail and grab the soft tissue part of our ears and drive us to the ground. It was very painful. While doing this to my brother one day, he decided to fight back. He had it. He broke free from her grip. While doing so, he hit her. As a child, I jumped to protect my mom. Which kid wouldn’t want to protect their mom? A few minutes later, she did the same thing to me for jumping in.

I choose only to see the good in my mom. I choose to “forget” what she did to us. This helped me survive as a child. I call this Potential Trauma Lensing.

Effects of Potential Trauma Lensing

This lensing forces us to see the “Shiny” inside someone. This isn’t necessarily a bad thing, but it will come to bite us in the long run. Often times I hear people bash the homeless, and I stop them pointing out the life of the homeless. There is a reason they are in the spot they are in and not all of them are bad. This gives many of the homeless I encounter a sense of being seen and human. Seeing the “shiny” in someone has brung about great healing in others. However, only seeing the shiny isn’t true and has led me down some hurtful roads. We can see what’s there, but we can’t make what’s their reality. The next story of a close friend in my life is how this Potential Trauma Lensing affected my life.

A close friend

I grew up with two extremely close friends. For the sake of privacy, I will call them Bob and Rob. I met Bob at school. When I met Bob, we both didn’t have any expectations of each other. We didn’t choose to see only good or bad. We saw each other as each other. Bob and I are still good friends and I often miss talking to him. While Rob on the other hand was another kid in the neighborhood. Growing up, we didn’t really have expectations of each other. I saw him as a fun kid to play with. We played all kinds of imaginary worlds. I was able to be the kid I wasn’t allowed to be around him.

As we grew up, he started going down different paths. Even though I saw warning signs, I choose to still see him as the friend I could be the kid I wasn’t allowed to be. As I went to college, and he started his college life, we drifted apart more and more. I was always there to help. I always choose to see the good in him and he in me. This was the Potential Trauma Lensing at play. After his first marriage failed due to abuse, He changed. I continued looking for the good in people, while he started seeing the darker sides of people.

Married Life

After I married, my wife and I moved 2 hours away. I lived in some rough conditions. He imposed aspects of his failed marriage onto my marriage. He saw my wife as an abuser and often talked bad about her and my living conditions. I, however, choose to see the good in each situation. When I should have been seeing the truth. It was hell with some good things. When we moved back to my hometown, things got better between us. It was nice for a while. We often played games and had game nights. Keeping true to our child-like states. He was there for my kids’ births and I was there for his kids’ birth. It was nice. I choose to keep seeing that side of our relationship.

The downfall

After my parents died, my view of the world was destroyed. No longer could I see my life growing up as fluffy and happy. The clouds I grew up with turned into the truth and it didn’t turn into truth that made sense. Complex PTSD showed its ugly head and it was ugly. The good fun part of me died. At this point in my life, I was just trying to survive. Instead of seeing the truth, I was suffering, He choose to look through the potential lensing like I was with him. However, the realisim was there. He was stuck between the two. I needed him to be the fun friend. I needed him to be my supporting friend. That wasn’t how he was.

The Potential Trauma Lensing

I choose to keep seeing him as a supportive friend. He chooses to still keep seeing me as his childhood friend. We both had the same lensing going on. He went as far as to take me to a mountaintop and threaten to leave me there if I didn’t wake up. He didn’t because of a storm. After being clean for a month of my addiction, We hung out, I was so excited I allowed my addiction to control the interaction. It was my fault. I longed for him to stop me, but he did not.

He moved away for work. I choose to still see him in the light of a good supportive friend instead of seeing that our relationship was split apart. During our time apart I learned to draw boundaries on myself. A while ago, he stated he was coming into town and wanted to grab lunch. I was excited, but I also drew a boundary, mainly on myself asking him to call me out.

The day before the meetup, I messaged him to confirm and He stated he was canceling. He later told me that he “didn’t want me to relapse”. Which was a lie. That’s when the lensing broke and I was able to see things as truth. We were at two different points in our lives. He couldn’t be a supportive friend because He was still stuck in the hurt of a past relationship. I couldn’t be the fun friend because I was trying to rebuild my inner child.

Holding onto Potentials

When you hold onto the “Shiny” aspect of people, we fail to see the consistency when they show us they are not that shiny. They are not the potential that we need from them. As you can see in the story, we both hurt each other over and over again. He took me to a mountain top with full intention of leaving me there. I choose to see the good in him. I held on tight to that view and he did with me.

What are you holding onto in people?

Breaking The lensing

Accepting Reality

The first step in breaking free of Potential Trauma Lensing is accepting reality as it is. When someone repeatedly shows us who they are, we should trust and believe them. We shouldn’t constantly try to see them in another light. It’s up to us to accept this reality. It’s a painful thing. The thing about this though, this new reality, might just be temporary. I may rebuild my inner child and be child-like again. I may become what he needs, and he may become what I need. We may become close friends again. However, at this moment, we are not. I have accepted this reality. I’m tired of hurting myself by rejecting this reality.

Self-Focus and Growth

Instead of using all that energy on someone else. I have chosen to invest in myself. At the core of the issue, we as humans want validation. That validation should come from within. At the end of the day, all we have is ourselves. If we are unable to be with ourselves, then how can we be with others? So, let’s take the energy we are placing towards our expectations, and put it back into ourselves. Let go of the self-inflected hurts and move forward. We need to accept that people change.

Acceptance and Moving Forward

Instead of trying to make people in our own minds into something they are not, we should accept them as they are. Our mental well-being begs for this. Once we embrace this reality, this world as it is, and not how we would have it, there is a sense of peace. This means taking off those trauma glasses. It’s ok to be hurt by others. It’s not ok to keep looking at the world through that lens.

Accepting the world as it is is hard, but worth it in the long run. As always, Please seek professional help if you need it. The Trauma Lenses can be glued to our faces. A well-trained trauma therapist can help take those glasses off.

You got this.

Additional resources

Speedtest To Ninja

Speedtest To Ninja

In a previous blog, we discussed doing a speed test on a computer using PowerShell. Let’s take that script and expand on it with three lines of code and some prep time. This will allow us to update items inside our Ninja One RMM tool. So we can push a Speedtest To Ninja One.

What’s Ninja One?

Ninja One is an amazing RMM tool. I have used many different ones over the years and Ninja one blows my mind. it has a strong community behind it and it keeps growing. It’s the only rmm tool that isn’t afraid to make mistakes and grow. When in used continuum, I saw many times, largely requested items went to the void. While in ninja, It never goes to the void. So, if you are looking for a Good RMM, Ninja One is amazing. With that said, let’s go deep into custom fields and how to set them up for script inputs.

Ninja One Custom Fields

There are currently two ways to make a custom field for a computer. The first is global. This means all companies, roles, and devices will have them. The other way is through the roles. Both options live under the Administration > Devices. Today we are going to setup a Role Custom Field. We are going this route because we don’t want the isp speed check information for internal servers and such.

  1. Click Administration
  2. Click Devices
  3. Click Role Custom Fields
  4. Click The Add Button
  5. Click Fields

This next part is important. The label is the text that you will read. The Name is what will be used to call the field later. The field type is what you will make it. For example, multi text, text, date, etc… The first custom field will be the following:

  1. Label: ISP
  2. Name: isp
  3. Type: text

When you click create, the next window will appear. This window is more important. This is where you can choose to allow scripts, APIs and more. If you are planning to allow your technicians to edit this field, then set the technician to editable. The next is script. This is where the script comes into play. This allows the Ninja command line interface to push the Speedtest to Ninja. It has to be at least write for it to work. Next, is the API option. If you are planning to do some special API stuff, this is where you give your field permissions for the APIs. The label is just a label, the description is just a description, the tooltip allows you to give context, the footer text is just that, footer text and finally, you can make it required.

Speedtest to Ninja One

Follow the same steps to create the DownloadSpeed, and UploadSpeed fields. You want them both to be text and you want the script to be at least write. Now, if you have done all that, you are ready to add the ninja command line to the speed test script. This is going to be shockingly easy. The first step is to put your return into a return variable.

$returnInfo = [PSCustomObject]@{
    Server     = $server
    ISP        = $ISP
    Download   = $DownloadSpeed
    Upload     = $uploadSpeed
    ResultsURL = $SpeedTestURL
}

Once you have a returnable variable, let’s pass them into the Ninja One command line interface. First notice the PowerShell module name is NJCLiPSh. The commands all start with Ninja. If you want to dig deeper, you can read up on the Ninja One documentation. I will place additional resources at the end.

The command we are going to be using to update our custom fields is “Ninja-Property-Set”. This command will allow us to set any “script” enabled property. It’s as simple as stating the name and value. The auth from the computer will confirm everything is right and update only that device’s property. It’s amazingly simple.

Ninja-Property-Set isp $returnInfo.ISP
Ninja-Property-Set DownloadSpeed $returnInfo.Download
Ninja-Property-Set uploadspeed $returnInfo.Upload

There are many more things you can do with this script. After building out the Speedtest script, I found out someone else did it better. Which is normal and ok. Check out Mikey O’Toole’s exploring into custom fields, here. He goes through different ways to address the custom fields.

Speed test with PowerShell

Speed test with PowerShell

Often times I need to run a speed test on a remote machine. Doing a speed test tends to help you understand what’s going on with the end user’s computer. For example, currently, my ISP is having issues. I am getting around 6mbps down and 75 Mbps up. If I called in and said I couldn’t watch training videos… that’s why. so it’s essential to know the speeds. That’s why we want to do a speed test with Powershell.

The Script

#Tests if C:Temp Exists, If it doesn't, makes it. 
$CTemp = "c:\Temp"
if (!(Test-Path $CTemp)) { New-Item -Path "c:\" -Name Temp -ItemType Directory }
if (!(Test-Path "$CTemp\SpeedTest")) { New-Item -Path "c:\" -Name Temp -ItemType Directory }

#Download the Speed Test Tool. 
$URL = "https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-win64.zip"
$DownloadPath = "$CTemp\SpeedTest.Zip"
if (!(Test-Path $DownloadPath)) { Invoke-WebRequest -Uri $URL -OutFile $DownloadPath }

#Expand the Zip File
Expand-Archive $DownloadPath -DestinationPath "$CTemp\Speedtest" -Force

$test = & "C:\temp\Speedtest\speedtest.exe" --accept-license

$DownloadSpeed = [regex]::match(($test | where-object { $_ -like "*Download:*" }).trim(), '[0-9]+\.?[0-9]*').value
$uploadSpeed = [regex]::match(($test | where-object { $_ -like "*Upload:*" }).trim(), '[0-9]+\.?[0-9]*').value
$ISP = ($test | where-object { $_ -like "*ISP:*" }).trim().split(":")[1].trim()
$server = ($test | where-object { $_ -like "*Server:*" }).trim().split(":")[1].trim()
$SpeedTestURL = ($test | where-object { $_ -like "*Result URL:*" }).trim().split(" ")[2].trim()

[PSCustomObject]@{
    Server     = $server
    ISP        = $ISP
    Download   = $DownloadSpeed
    Upload     = $uploadSpeed
    ResultsURL = $SpeedTestURL
}

The Breakdown of the Speed test with PowerShell

As we enter this script, you can see my laziness already. The first thing I do is make a string called ctemp for the “c:\temp”. This way I don’t have to type “c:\temp” repeatedly. Next, we test the path to see if c:\temp exists. If it doesn’t, we make it. We do this with the new-item command with the name as temp and the item type as a directory. We do the same thing with c:\temp\speedtest for later. If you really want to get fancy, you can replace the C: with an $env:systemdrive.

Building the folders

$CTemp = "c:\Temp"
if (!(Test-Path $CTemp)) { New-Item -Path "c:\" -Name Temp -ItemType Directory }
if (!(Test-Path "$CTemp\SpeedTest")) { New-Item -Path "c:\" -Name Temp -ItemType Directory }

The next step is to download the speed test application from ookla. We need the URL and where it’s going to be downloaded. That’s why the URL has the URL needed. We want to call the file speedtest.zip. Next, we test to see if we already downloaded it. If we didn’t, we download the file using the invoke web request and the out file tags.

Downloading the app

$URL = "https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-win64.zip"
$DownloadPath = "$CTemp\SpeedTest.Zip"
if (!(Test-Path $DownloadPath)) { Invoke-WebRequest -Uri $URL -OutFile $DownloadPath }

Once we have the file downloaded, we need to extract the Speed test files. We use the expand archive command to force the download to the c:\temp\speedtest folder that we made at the beginning. I use the force flag here to overwrite anything just in case the file was already there.

Expanding the drive

#Expand the Zip File
Expand-Archive $DownloadPath -DestinationPath "$CTemp\Speedtest" -Force

Next, we run the Speed test with PowerShell. In PowerShell, you can run apps directly inside the shell and input that data directly into the shell by using the & sign. With this software, we need to accept the license if we want to do this script without human interaction. Finally, we want to push its output into a variable. Since it’s a test, let us call it a test.

Running the Speed test with PowerShell

$test = & "$CTemp\Speedtest\speedtest.exe" --accept-license

The variable $test contains a few strings with the information we need. It’s time to work with those strings. The string contains the server, isp, download, upload, and jitter information. Here is an example output of what this little program produces:

Speedtest by Ookla

     Server: Piedmont Redacted
        ISP: Spectrum Business
    Latency:    22.46 ms   (0.12 ms jitter)

   Download:   166.84 Mbps (data used: 217.5 MB)

     Upload:   194.09 Mbps (data used: 224.6 MB)
Packet Loss:     0.0%
 Result URL: redacted

The first item I want to extract is the download. The code is a little complex so lets start from the inside. We start off with our $test variable. We want to find the string line that contains “Download:” and then trim that up.

($test | where-object { $_ -like "*Download:*" }).trim()

Next, we need to wrap this inside a regex match. We are using the .net structure here using the [regex]:match. Don’t use matches, it will give you additional information. The match uses our variable and the regex to match with. The regex is the hardest part. So let’s take it apart.

The Regex

'[0-9]+\.?[0-9]*'

The first part [0-9] is searching for characters 0 – 9. However, it only looks at the first digit. The + looks for the rest until we reach a “.”. The “\” is before the “.” because “.” is a used variable in regex. If we stop here, we only get the first part of the download speed. We don’t get anything past the “.”. So we add the “?”. Once we do this it allows us to continue. At this point, we look for another [0-9]. Once again, it’s just the first character. We want everything past that so we add the “*”. Now we have the first match. This is the download speed. Once we have the regex information we ask for only the value. We do this with the upload speed as well.

$ISP = ($test | where-object { $_ -like "*ISP:*" }).trim().split(":")[1].trim()
$server = ($test | where-object { $_ -like "*Server:*" }).trim().split(":")[1].trim()
$SpeedTestURL = ($test | where-object { $_ -like "*Result URL:*" }).trim().split(" ")[2].trim()

Now, we need to work with The ISP. We search for the “ISP:” inside our test variable. Like before, we trim up the string. This removes the spaces at the start and end. Then we split this string with the “:”. The split is here because it makes sense. We select the second object from that split as it contains the text. The first, which is also 0, doesn’t contain the text. Now we have the string, we once again trim it up. There you go. That’s the ISP. We do the same thing with the server as the ISP. The results URL is a little different. We split the space and then select the third object.

Displaying the information

Finally, we create a PS custom object and place each piece of useful information into it. When you launch the script, this information will return and you can see it inside your rmm feedback. From here, you can add this information to your RMM tool in custom fields if you wish. Since I use Ninja at the moment, I will go over that later.

That’s it, Speed Test with PowerShell is at your fingertips. I hope you enjoy it.

Additional Resources