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

Clatent

Technology | Fitness | Food

  • About
  • Resources
  • Contact

PowerShell

One-Liner Wednesday December 14, 2022

December 14, 2022 by ClaytonT Leave a Comment

Ever have to migrate a share? Or see who is still accessing a share you need to do work on and want to make sure everyone is off of it so the user doesn’t lose any data? Here is the perfect one liner.

Get-wmiobject -computername ServerName win32_serverconnection | select-object sharename,username,computername

All you have to do is put your Server name in and then this will show all shares that users are connected to with their computer name. You could run it right on your server you want to check the shares on as well. This has been super helpful when doing maintenance and when we’ve had to migrate storage to different servers/locations.

Microsoft Learn:
Get-wmiobject

Tagged With: One Liner Wednesday, PowerShell, Windows Server

Read-Only Friday December 9, 2022

December 9, 2022 by ClaytonT Leave a Comment

I wasn’t going to do this for today, but decided to change it up and do it anyways. What are your thoughts on ChatGPT? I’ve seen strong opinions both ways on this, but curious on your feelings on it. One point I see it being a very useful TOOL that a person can have in their toolbox, but if it is too heavily relied on or trusted, the person can lose some important skill sets such as learning how to learn and putting your own spin on something. Also if the person is looking up completely new information, ChatGPT could make a great case with false information and the person wouldn’t know until they are called out. As long as the person is still verifying the I’m good with ChatGPT and isn’t using it as their only source of research. Then again, I’m aging myself here, people use to site wikipedia which again could be manipulated.

Also right now ChatGPT is free, who knows 6 months down the road if that will be the case. And if it has become a habit for the person, they will pay the money because  “they can’t live without it.” I do really love this type of technology and seeing how it has progressed so much over the years. It will only keep on getting better, and yes bad actors will abuse to too, but that is always the case with any type of technology or process.

And for a quick example, I had it write a “Read-Only Friday” post for me.

“In today’s fast-paced, always-connected business world, it can be hard to step away from our screens and disconnect from technology. But taking a break from technology, even for just one day a week, can have numerous benefits for our mental health, productivity, and overall well-being. That’s why many people are adopting the practice of “read-only Friday,” where they disconnect from technology and spend the day away from screens.

The effects of technology on our mental health and well-being are well-documented. Constant notifications, distractions, and the pressure to always be available can lead to increased stress, anxiety, and even burnout. In fact, a recent study found that excessive screen time can even change the structure of our brains, leading to decreased concentration and problem-solving abilities.

By taking a break from technology and disconnecting from screens, we give our brains a much-needed rest and allow ourselves to recharge and refocus. This can lead to increased productivity, improved mental clarity, and better overall health.

But disconnecting from technology doesn’t have to mean being unproductive at work. In fact, read-only Friday can be a great opportunity to focus on tasks that require deep concentration and focus, such as brainstorming, strategic planning, or creative problem-solving. You could also use the time to catch up on reading, attend a training or learning session, or even just take a long lunch break to recharge and refocus.

To make the most of your read-only Friday, plan ahead and decide what you want to do with your day. This could include scheduling specific tasks or setting aside time for relaxation and self-care. You could also try setting boundaries for yourself, such as turning off notifications on your phone or limiting your access to certain apps or websites.

Overall, read-only Friday is a great way to disconnect from technology and give your mind and body a much-needed break. So why not encourage your team to try it out and see how it impacts their productivity and well-being? You might be surprised by the benefits.”

That took a matter of seconds…

Project Site:

ChatGPT

Tagged With: ChatGPT, PowerShell, Read-Only Friday

One-Liner Wednesday December 7, 2022

December 7, 2022 by ClaytonT Leave a Comment

Today’s one liner is another basic one, but very powerful. Ever need to look for a file, or better yet multiple files then need to rename or delete them?

Get-Childitem -Path C:\windows -Recurse -Filter *test* -erroraction SilentlyContinue  | out-gridview -PassThru | Remove-Item -WhatIf

What this one liner will do is search all of the folders/files in the C:\Windows directory that have the word test in the file name or folder. It will even pull things like memtest.efi.mui and Microsoft.Windows.RemoteAttestation.Core.dll. The stars basically tell the search I can’t remember what else is after and/or before the letters I put, but I know there are letters there. Then with its results will put it into a nice window that you can select which file(s) you want to delete. Once you have highlighted the files/folders you want to delete, you can press ok, then they will be deleted(You will need to remove the “-WhatIf” from my code above because I like you, and just in case you just run this without double checking, files don’t get deleted)

Another thing to note is that I put the -Recurse parameter after the folder, this tells PowerShell to search sub directories too. If you remove it, it will only search that current directory.

And this can be used in the registry as well, just make sure that -WhatIf is used until you are 100% the code is working correctly.

Microsoft Learn:
Get-ChildItem

Tagged With: Get-ChildItem, One Liner Wednesday, PowerShell

Module Monday December 5, 2022

December 5, 2022 by ClaytonT Leave a Comment

I came across this module over the weekend, and have to say it’s a great little module. I’ve posted other modules that can do parts are of this, but this is great for quick checks and one offs. To name a few it grabs info for computer & operating system info, hardware devices with errors, hardware devices which are absent, and fixed storage volume details.

It can also install missing updates, update your PowerShell help, clear your recycling bin, delete temp files, and install/update sysinternals.

Definitely a great module to have in your toolbox.

PowerShell Gallery:
PSWinVitals/0.6.8

GitHub:
PSWinVitals

Tagged With: Module Monday, PowerShell

One-Liner Wednesday November 30, 2022

November 30, 2022 by ClaytonT Leave a Comment

It’s already Wednesday, can you believe it? Nothing crazy initially from today’s one liner, but once you learn the concepts, your imagination is the limit.

# Local Computer

(gcim Win32_OperatingSystem).LastBootUpTime

# Remote Computer

$s = new-cimsession -computername comp1,comp2 -credential credential

(gcim Win32_OperatingSystem -CimSession $s).LastBootTime

**GCIM is an alias for Get-CimInstance

So what does all of this mean? The first script will give you the last time your local computer booted up, and the second one does it for a remote computer. This is a great one liner(technically 2 for the remote as you need to create the CimSession) for you or your support team to make sure the user has really restarted their computer. Also a great way to check if a script you have that is supposed to reboot the device actually reboots it, and to not go any farther until the reboot has actually happened. I’d recommend having this one liner in your toolbox as well as creating a function out of it so that you can put parameter’s in place to make it even easier for your support team to use.

You also can see that I created a CimSession for the remote computer(s). This makes connecting to remote computers much easier and allow you to scale when needing information from CIM commands.

There is just so much information that you can get from the CimInstances and CimClass, that I can’t put here, but if you are looking for any thing related to hardware to a device check out these out. You can even see how much battery charge is left in a computer.

Get-CimInstance:
Microsoft Learn

Get-CimSession:
Microsoft Learn

CIM Classes:
Microsoft Learn

Tagged With: Cim, One Liner Wednesday, PowerShell, Remote

Module Monday November 28, 2022

November 28, 2022 by ClaytonT Leave a Comment

Hope all of my US friends had a good holiday! Now it’s Monday and we are back for another Module Monday. This is an important one, as it Is currently replacing a couple other modules as they are being depreciated. The 2 that are being depreciated are AzureAD and MSOnline if you didn’t know already. I’d check your scripts if you are still using them and convert them sooner than later.

So what is replacing these 2 modules? MS Graph, which doesn’t completely replace all the functionality as easily as we would like, but Microsoft is adding more features to it. This is how you will get license counts, Azure AD information, Teams, Exchange, Outlook, and any other 365 applications.

Also a great thing with Microsoft Graph is that it is cross-platform on PowerShell 7 and above so it doesn’t matter if you are using macOS, Linux, or Windows. You can still use it on Windows PowerShell 5.1 too.

PowerShell Gallery:

https://www.powershellgallery.com/packages/Microsoft.Graph/1.17.0

Microsoft Documentation:

https://learn.microsoft.com/en-us/powershell/microsoftgraph/overview?view=graph-powershell-1.0

Tagged With: 365, Microsoft Graph, Module Monday, PowerShell

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 13
  • Page 14
  • Page 15
  • Page 16
  • Page 17
  • Interim pages omitted …
  • Page 19
  • 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