• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Clatent

Technology | Fitness | Food

  • About
  • Resources
  • Contact

PowerShell

One-Liner Wednesday March 15, 2023

March 15, 2023 by ClaytonT Leave a Comment

Today’s one-liner may not be a direct PowerShell command, but it can be run inside the PowerShell terminal. Are you using Intune, or looking into using Intune? If your already using it, you know by default when you add a user it sets them as a local administrator(I’m not sure exactly why, but that can be a topic for another blog post), and of course we don’t want our users to be local administrators on their computers. To resolve this issue, all you need to do is remove them from the local administrators group like below.

net localgroup administrators azuread\user@domain.com /delete

The only change needed is changing “User@domain.com” to their login address. I’d recommend adding this to your new device script, and if you do not have a new device script, I’d start one now, so you can keep adding and automating things to save you time and have consistent deployments.

Also, take a look at Azure Functions to see how you can deploy code and automate things on a bigger scale.

Tagged With: AzureAD, Intune, One Liner Wednesday, PowerShell, Windows

Read-Only Friday March 10, 2023

March 10, 2023 by ClaytonT Leave a Comment

It’s Friday, and I’m going to keep this one short in sweet copy. I’ve mentioned this module before, but it is so helpful if you use any of the products, that I want to make sure you don’t miss out on it! Yes, I know it’s Read-Only Friday, but this module will step up your documentation game ten fold.

AsBuiltReport on Github or you can find them on asbuiltreport.com.

What they have created is multiple modules depending on the product you need documentation on, and with one quick line of code, you get a full breakdown of the product you requesting information on. How about a 144 page document on your Active Directory? Not bad, right?

Check them out, and let me know what you think!

GitHub:
https://github.com/AsBuiltReport

Website:
https://www.asbuiltreport.com/

Tagged With: AD, Automation, Documentation, Fortigate, Fortinet, Module Monday, PowerShell, Read-Only Friday, Reporting, Veeam, VMWare, Windows Server

One-Liner Wednesday March 8, 2023

March 8, 2023 by ClaytonT Leave a Comment

Are you using VMWare? Ever had to troubleshoot why a VM isn’t working? Or need to know the status of a virtual machine? If you haven’t used PowerCLI before(I know I’ve mentioned it previously), check out this one liner.

 get-vm servername | select-object name, powerstate, usedspacegb, provisionedspacegb

What this does is first finds the server you are looking for with “servername.” Then it shows the server name, whether it is turned on or off, how much storage space is used, and finally how much storage is provisioned. This gives you a very quick overview of the status of the server.

I know, very simple, but it works… and you can expand on this. You could not put a servername in, and it will show all of your virtual machines with the information above.

What about if you have 100s or even 1,000s of servers, you could export to gridview or even better to excel with the importexcel module for filtering.

Hope you found this useful, and if your not already using the PowerCLI module to start using it and make your life easier.

PowerShell Gallery:
PowerCLI

Tagged With: Automation, Documentation, PowerCLI, PowerShell, Reporting, VMWare, Windows Server

Module Monday March 6, 2023

March 6, 2023 by ClaytonT Leave a Comment

Hope everyone had a great week and weekend! Took last week off as we went to Disney and I ran the Disney Princess Half Marathon. If you’re looking for your first half marathon, or a fun running experience, this is it!

Then decided yesterday to run another Half Marathon with some friends, but in slightly different conditions… over 1,000 more feet of elevation gain, 50 degrees colder, and no princesses!

With that said, how are you using PowerShell to track/measure your fitness? I know Adam Driscoll has an old module for Strava from 2018. I haven’t had a chance to try it out yet, but will be this week… and hoping it still works. Would be nice integrating it with PowerShell Universal. Garmin’s is locked down. Anyone exported info Apple/Google Health?

PowerShell Gallery:
Strava

Strava API
Strava API Documentation

Tagged With: Module Monday, PowerShell

One-Liner Wednesday February 22, 2023

February 22, 2023 by ClaytonT Leave a Comment

Ever wanted a quick and easy way to see what operating systems all your computers are running to the detail of the version number? Then wanting to know the last time they logged on?

PowerShell provides a powerful and efficient way to perform this task. In this blog post, we will show you how to use a PowerShell one-liner to search for computers in a specific OU and view their name, operating system, OS version, and last time they logged in.

Searching for computers in a specific OU

You can start by searching for computers in a specific OU. The “Get-ADComputer” cmdlet can be used to retrieve information about computer objects in Active Directory. Here is an example command that retrieves all computers in the “Computers” OU:

Get-ADComputer -SearchBase "OU=Computers,DC=example,DC=com" -Filter * -Properties Name, OperatingSystem, OperatingSystemVersion, LastLogonDate

This command uses the “-SearchBase” parameter to specify the distinguished name of the search base where the search should be conducted. In this case, we are searching in the “Computers” OU of the “example.com” domain. You should replace this with the distinguished name of the OU you want to search in.

The “-Filter” parameter is used to retrieve all computer objects in the specified OU, and the “-Properties” parameter is used to specify the properties you want to retrieve. In this case, we are retrieving the “Name”, “OperatingSystem”, “OperatingSystemVersion”, and “LastLogonDate” properties.

Formatting the output

The output of the previous command is not very user-friendly, so we need to format it to make it easier to read. We can use the “Select-Object” cmdlet to select the properties we want to display and format the output using the “Format-Table” cmdlet. Here is the final PowerShell one-liner:

Get-ADComputer -SearchBase "OU=Computers,DC=example,DC=com" -Filter * -Properties Name, OperatingSystem, OperatingSystemVersion, LastLogonDate | Select-Object Name, OperatingSystem, OperatingSystemVersion, @{Name="LastLogonDate";Expression={[DateTime]::FromFileTime($_.LastLogonDate)}} | Format-Table -AutoSize

This command retrieves all computer objects in the specified OU and selects the “Name”, “OperatingSystem”, “OperatingSystemVersion”, and “LastLogonDate” properties. The “LastLogonDate” property is converted to a readable date format using the “FromFileTime” method of the “DateTime” class. Finally, the output is formatted using the “Format-Table” cmdlet to display the information in a table format. You could even change “Format-Table” and use “Out-GridView” to give you an excel like experience where you can filter and sort columns… and to make it even more advance if you are trying to remove or disable computers, you could use the Out-GridView with a “-PassThru” parameter then pipe it to a delete or disable. ***Make sure to use -WhatIf so you don’t by accident delete all of the computers that you searched for!

Conclusion

In this blog post, we have shown you how to use a PowerShell one-liner to search for computers in a specific OU in your Active Directory and view their name, operating system, OS version, and last time they logged in. This information can be very useful for managing your domain and keeping track of your computers. This can be used for reporting and for autoamating tasks that only pertain to certain versions of Windows OS. By using PowerShell, you can quickly and easily retrieve this information and format it in a way that is easy to read and understand while using it for automations.

Tagged With: AD, Automation, One Liner Wednesday, PowerShell, Reporting, Windows Server

Module Monday February 20, 2023

February 20, 2023 by ClaytonT 2 Comments

Hope you had a great weekend! And since the weekend is over, it’s now time for Module Monday. We have a great one today that I feel you will see immediate ROI from using it.

uGit by James Brundage is a PowerShell module that provides users with a simplified interface to interact with Git repositories. It includes a set of functions that can be used to perform various Git-related tasks, such as cloning repositories, committing changes, pushing and pulling changes, and creating branches, among others. Here are some of the key features of uGit:

Simple and Easy to Use

uGit provides users with a simplified interface to interact with Git repositories. The module’s functions are easy to use and don’t require users to have extensive knowledge of Git commands. With uGit, users can automate their Git workflows with just a few lines of PowerShell code.

Git Repository Management

uGit includes functions for managing Git repositories, such as cloning, creating, and deleting repositories. The module also provides users with the ability to switch between repositories and set a default repository for their Git workflow.

Committing and Pushing Changes

With uGit, users can easily commit and push changes to their Git repositories. The module includes functions for adding and removing files from the staging area, committing changes, and pushing changes to the remote repository.

Branch Management

uGit includes functions for creating and deleting Git branches, as well as switching between branches. The module also provides users with the ability to merge branches and resolve merge conflicts.

Git Configurations

uGit provides users with the ability to set and manage their Git configurations, such as user name and email, Git editor, and Git credentials.

In conclusion, uGit users can automate their Git workflows and perform complex Git-related tasks with ease. If you’re a PowerShell user looking to integrate Git functionalities into your workflows, uGit is definitely worth checking out.

Github:
uGit

PowerShell Gallery:
uGit 0.3.6

Tagged With: Module Monday, PowerShell

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 9
  • Page 10
  • Page 11
  • Page 12
  • Page 13
  • Interim pages omitted …
  • Page 20
  • Go to Next Page »

Primary Sidebar

Clayton Tyger

Tech enthusiast dad who has lost 100lbs and now sometimes has crazy running/biking ideas. Read More…

Find Me On

  • Email
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

Recent Posts

  • Learning ValidateSet in PowerShell: Valid Values Only
  • Teams Chat and PowerShell – How to add value!
  • EntraFIDOFinder: New Web UI and Over 70 New Authenticators
  • January 19, 2026 Updates to EntraFIDOFinder
  • v0.0.20 EntraFIDOFinder is out

Categories

  • 365
  • Active Directory
  • AI
  • AzureAD
  • BlueSky
  • Cim
  • Dashboards
  • Documentation
  • Entra
  • Get-WMI
  • Learning
  • Module Monday
  • Nutanix
  • One Liner Wednesday
  • Passwords
  • PDF
  • Planner
  • PowerShell
  • Read-Only Friday
  • Reporting
  • Security
  • Uncategorized
  • Windows
  • WSUS

© 2026 Clatent