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

Clatent

Technology | Fitness | Food

  • About
  • Resources
  • Contact

The Blog

One-Liner Wednesday January 25, 2023

January 25, 2023 by ClaytonT Leave a Comment

Today’s one-liner is one that you or may not have to use a lot depending how your environment is setup and how you setup computers. Either way, its great to have it so you don’t have to go digging for it in the GUI. Ever had a time when you are trying to connect to a computer, and can’t? You make sure the computer is connected to the right wifi or that it is wired in, has the right IP address, and has internet… but nothing seems to work. Then you turn off your firewall and you can ping it… you know you can’t leave the firewall off all the time. What to do?

Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -Enabled True

There is your answer. That simple one line of code enables pinging without turning off your whole firewall. You can do this in group policy or add it to your golden image for imaging computers.

Hope this helps and saves time you prepping computers!

Tagged With: Automation, Firewall, One Liner Wednesday, PowerShell

Module Monday January 23, 2023

January 23, 2023 by ClaytonT Leave a Comment

It’s already the 4th Monday in January, can you believe it? At least that means we get an extra Module Monday next week, but lets stick to this one for right now!

Enjoy Markdown, and want to generate markdown help for your existing module, or create markdown help for modules you are currently working on? PlatyPS is the module you need.

Supported scenarios:

  • Create Markdown
    • Using existing external help files (MAML schema, XML).
    • Using reflection
    • Using reflection and existing internal external help files.
    • For a single cmdlet
    • For an entire module
  • Update existing Markdown through reflection.
  • Create a module page .md with summary. It will also allow you to create updatable help cab.
  • Retrieve markdown metadata from markdown file.
  • Create external help xml files (MAML) from platyPS Markdown.
  • Create external help file cab
  • Preview help from generated maml file.

If any of that looks to be useful, definitely check out PlatyPS!

Github:
PlatyPS

Tagged With: Documentation, Markdown, Module Monday, PowerShell

One-Liner Wednesday January 18, 2023

January 18, 2023 by ClaytonT 2 Comments

Do you use 365? Ever needed a quick list of all your users and their mailbox size? What about having it nicely formatted? Or do you only want to see a certain size mailbox? This quick one-liner is a good starting point.

Get-EXOMailbox -ResultSize Unlimited | Get-EXOMailboxStatistics | Select DisplayName, ItemCount, TotalItemSize | Sort-Object TotalItemSize -Descending | Export-Excel -Path C:\scripts\MailboxSizes.xlsx -AutoSize

What this does is uses the current way to get a 365 mailbox(Get-mailbox is deprecated), grabs all the mailboxes, selects only the Display name, amount of emails, and total size of their mailbox. It will then put the largest mailbox at the top and smallest at the bottom. After all of that, it exports it to an excel file that you can manipulate how you like. If you haven’t already used Doug Finke’s ImportExcel module, I’d recommend it to get creative with your formatting without ever opening Excel to format. You could add it so all mailboxes over a certain size are a certain color.

Hope this helps let me know if you expand on this even if its not a one liner, I’d love to see!

Tagged With: 365, Exchange, One Liner Wednesday, PowerShell, Reporting

Module Monday January 16, 2023

January 16, 2023 by ClaytonT Leave a Comment

It’s Monday, and today we have another module by Doug Finke. Have you been using ChatGPT? Have you been enjoying it? Tired of always having to login and have a web browser open to use it? Why not have it right in your editor?

Welcome PowerShellAI! It is exactly what you think… it is OpenAI right in your VSCode and/or PowerShel Terminal. I’ve been testing this and really like it and can’t wait to see what else Doug does with it. One of the features I like is that you can set how risky of a response you OpenAI to use, where 0 is no to little risk, or use 0.9 where you can allow it to be a bit more flexible with it’s response.

Test it out and let me know what you think!

PowerShell Gallery:
PowerShellAI 0.1.0

GitHub:
PowerShellAI

Tagged With: Automation, Module Monday, PowerShell

Read-Only Friday January 13, 2023

January 13, 2023 by ClaytonT 2 Comments

Today’s Read-Only Friday is about retiring/upgrading servers. Don’t worry no changing code today, but with Server 2012R2 going end of support Oct 10, 2023, I want to make sure you are aware and prepared to do it. By no means is this the definitive guide to do it, but hope this helps you create or improve your process for upgrading servers. Right now, I’d put a reminder in your calendar so you don’t forget and that you have enough time to take action on those servers.

I know it will depend greatly on what is on the server, but first thing before doing anything is making sure you have a valid backup. I’m not just talking about that your backup server of choice says it backed it up successfully, but actually restoring the server/files needed from the backup to ensure it works. We are decommissioning it for a reason, but while going through the process we want to make sure we have a backup just in case.

Next, I’d go through the server and make sure all services/software are documented as well as any important files. Even if you have documentation, I’d double check that all of it is correct, and that someone didn’t go out of scope and install something on it without documenting it. The last thing you need is when you shutdown the server or setup the replacement server that a department can’t do their work because the product they need isn’t online anymore.

A PowerShell one liner I’d recommend is “Get-WindowsFeature | Where installed” for one computer or you could run “Get-WindowsFeature -computername serv01,serv02 | Where installed” then you could pipe it to CSV or Excel to make it easier for documentation.

Then to get all programs installed

$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"

foreach($obj in $InstalledSoftware){write-host $obj.GetValue('DisplayName') -NoNewline; write-host " - " -NoNewline; write-host $obj.GetValue('DisplayVersion')}

This can be exported as well for easier documention as well.

Now that we know we have good back ups, we know what services/applications installed, and we did a once over for any out scope configs, I would ask your team to look over what you have to make sure nothing was missed. The more you do these, the less time it will take, but it’s always good to have a second set of eyes on it.

Great, with it having a second set of eyes on it, we can now build the new machine. Depending on your virtualization platform(Hoping you a test environment, if not look at AutomatedLabs), I’d create a PowerShell script to build the server, or if you have templates already, I’d use PowerShell to make the copy then configure IP and any one off applications and servers, as well as any files that would need to be on it. Make sure all windows updates are done to ensure none of them will break it. Once you have confirmed everything is working on the newer server os, you can now deploy it to production(Make sure to turn off the old one if it will cause issues). Before deploying it to production, I’d send out communication to users in case for some reason there is an issue, they will let you know right away or if there is anything they have to do on their side.

At this point I’d put all of the documentation for the new server together if you haven’t already which should be easy, as most of it is right in scripts. Once the new server has been working for a safe amount of time as it will depend on the importance of server, you can remove the old server and test server from your host(s).

I could definitely go in more depth on this, and if you have any questions on checklists or what to actually keep for documentation, let me know and I’d be glad to help out.

And yes, I know this is a Read-Only Friday topic, but most of the hard work is on the planning/documenting side which you can do on Read-Only Friday.

Tagged With: Automation, Documentation, EOL, PowerShell, Read-Only Friday, Upgrading, Windows Server

One-Liner Wednesday January 11, 2023

January 11, 2023 by ClaytonT 2 Comments

It’s Wednesday already, is that good or bad for you? Hoping it’s a good thing, and hoping todays one-liner makes it even better.

$Path = $env:TEMP; $Installer = 'chrome_installer.exe'; Invoke-WebRequest -Uri 'http://dl.google.com/chrome/install/375.126/chrome_installer.exe' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args '/silent /install' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer

What this one-liner will do is go out and fetch chrome and silently install or update it. Then it will delete the installer after it has been installed. You could add lines for logging in case you had other software that you wanted to install after, but I feel this is a great foundation if you’ve never done it before. If you start adding logging and other features(ie. confirming it has installed), I’d definitely take it out of the one-liner format for ease of reading/troubleshooting unless for some reason you need to keep it as a one-liner.

You can do this with many applications, you just have to make sure the URI and switches(Args) are correct.

Tagged With: App Deployment, Applications, One Liner Wednesday, PowerShell

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 8
  • 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

  • One-Liner Wednesday January 25, 2023
  • Module Monday January 23, 2023
  • One-Liner Wednesday January 18, 2023
  • Module Monday January 16, 2023
  • Read-Only Friday January 13, 2023

Categories

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

© 2023 Clatent