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

Clatent

Technology | Fitness | Food

  • About
  • Resources
  • Contact

PowerShell

New Feature Announcement for 365AutomatedLab

September 18, 2023 by ClaytonT Leave a Comment

I wanted to let everyone know as of this morning you can add and remove Teams and Teams Channels with only 1 line of code and an Excel Worksheet using 365AutomatedLab.

It’s as simple as this:

New-CT365Teams -FilePath "C:\path\to\365DataEnvironment.xlsx" -AdminUrl "<https://yourdomain.sharepoint.com>"

And to remove those teams:

Remove-CT365Teams -FilePath "C:\path\to\365DataEnvironment.xlsx" -AdminUrl "<https://yourdomain.sharepoint.com>"

Let me know what you think. Do you want the ability to add more than 2 additional channels? Any of the other parameters you would like added for teams and channels? Eventually, I’ll add them all, but rather start with the ones that you most use.

As always feel free to reach out and I’m always open to PRs.

365AutomatedLab

Tagged With: 365, 365AutomatedLab, Automation, PowerShell, Sharepoint, Teams

How ChatGPT saved our company $1500 in less than 15 minutes

September 15, 2023 by ClaytonT Leave a Comment

Let me set the stage… previously we had a batch file in our startup script to add/remove network drives. It worked great and didn’t have any issues. We moved away from an on-site file server to a cloud solution with local cache. They created a new batch file for us which worked perfectly… until we started looking at integrating Intune computers. Luckily, early on we caught this, and realized we needed a PowerShell script instead of a batch script. We reached out to the vendor with knowing they had PowerShell experience and asked if they could recreate the script using PowerShell. They came back with a quote of $1,500.

I looked at the batch script again, and said there is no way it costs that much to convert an already working batch script to PowerShell. So what did I do? I opened up the 26 line batch script, skimmed over it, then copied it into ChatGPT, and told it to convert the script to PowerShell. It created a PowerShell function within the script and when I followed up with an additional prompt to see if a certain drive was still present to delete it, it created that as well. It was 98% done, I only had to fill in our company data and one part they had an additional parameter that wasn’t needed. All less than 15 minutes. For context, this was with ChatGPT with GPT-4 back in early May 2023, as it is even better now.

Is ChatGPT always this accurate? No, but when you search on Google, Stack Overflow, or any other site, is it always accurate? I like to think of ChatGPT, Azure OpenAI, etc as a smart intern where you trust, but verify the work before implementing. Always test in a development environment as some code take down infrastructure(Same with other sites/LLMs)

Now, not only did I save the company $1,500, I saved time from all the meetings, paperwork(Purchase Order and misc), and testing with the vendor which I used to work on other projects!

Hope you found this helpful and gets you thinking of using ChatGPT, Azure OpenAI, etc more, but please make sure you know what you are testing and/or are in a complete test environment. And if for some reason you take down something in production by accident, let someone know asap what you were doing, so that it can be quickly resolved if you aren’t sure how to fix it.

Tagged With: Automation, Azure OpenAI, ChatGPT, PowerShell

Read-Only Friday August 4, 2023 End Of Life Server 2012R2 and managing EOL

August 4, 2023 by ClaytonT Leave a Comment

Read-Only Friday August 4, 2023

Do you still have any Windows Server 2012R2 or earlier in production? This is a friendly reminder that they will be going End Of Life October 10 of this year. If you do have any in production, what is your plan to decommission them? Do you still need the server, or will you be spinning up a new upgraded VM? Do you have the licensing to upgrade? What are your next steps?

Talking about End Of Life, how do you manage and track your equipment and licensing for this scenario? Do you have special asset/license management software, SharePoint list, SQL Database, Excel workbook, or even a csv with dates and costs?

If you’ve made it this far, I’m hoping this isn’t a surprise and this is only a reminder to keep following your plan, but if this is the first time you’re hearing this, please look at this now and put a plan in place, especially if you will need to purchase new licensing. While you are at it, I’d check those servers running 2012R2 and see how much of the services you really need running now, as a lot has probably changed since you first put them into production. Also, do you have enough resources to run both at the same time, or do you have to take a current backup(test to make sure the backup works), delete(or turn off and hope you don’t accidently turn it on while new server is on) your current 2012R2, then build the new on?

Good luck with your migrations and as always if there is anyway I can help, feel free to reach out! Have a great Friday, and remember no unscheduled changes today.

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

One-Liner Wednesday August 2, 2023

August 2, 2023 by ClaytonT Leave a Comment

Have you ever needed to create multiple 365 Groups/Security/Distribution at one time? This could be for a new department, new office, or even a new campaign that only certain people need access and email to. I won’t even go into the time it would take to do this in the GUI, but how would you add them scripting wise, as there are 4 types of Groups/Lists in 365. Do you only do one cmdlet at a time and hope someone doesn’t come back after you’ve already done some and they need to add another group with a cmdlet you’ve already used?

I have a nice simple one-liner to fix this issue.

Add-CT365Group -FilePath "C:\\Path\\to\\file.xlsx" -UserPrincialName "admin@domain.com" -Domain "domain.com"

That’s it.

Ok, to be fair, PowerShell wise that is all there is to it other than installing the 365AutomatedLab module from Github. After that only 3 steps needed, and well worth it. Here are the steps:

  1. Create a workbook in Excel, and have a sheet named “Groups”
  2. Add the Headers “DisplayName”, “PrimarySMTP”, “Description”, “Owner”, and “Type”
    1. DisplayName is self explanatory as this will be the Display name for the group
    2. PrimarySMTP is the email address without the @domain.com
    3. Description is self explanatory as this will be the description value for the group
    4. Owner is only a placeholder, but will be adding that soon
    5. Type will be the type of group it is – and will pull the corresponding cmdlet
      1. 365Group
      2. 365MailEnabledSecurity
      3. 365Distribution
      4. 365Security
  3. Add your Group information in the corresponding fieldsExcel worksheet example

After those are filled in, you can run the script from above pointing to where you saved that excel file, and all those groups you added to the Excel worksheet named “Groups” will be added (As long as you have the correct permissions)

It’s really that simple. I’m looking to expand the properties you can add into the groups, if there are any you’d rather see first, please let me know.

I hope you found this useful and it saves you time/headaches from having to more manually add them! As always if I can help out in anyway, please feel free to reach out!

Microsoft Documentation on Group Types

New-UnifiedGroup

New-DistributionGroup

New-MgGroup

Tagged With: 365, 365AutomatedLab, Automation, Groups, One Liner Wednesday, PowerShell

Module Monday July 31, 2023

July 31, 2023 by ClaytonT Leave a Comment

Well, here it is!  Module Monday, but this one is a module I’ve been working on for a bit and figured it’s time to put it out to the community for others to enjoy and improve. Have you had to test PowerShell scripts on your 365 tenant and really didn’t want to use your production environment, but wanted to keep the close as possible for testing accuracy? Then you’ll want 365AutomatedLab in your tool chest. It can also be used to add multiple users to an environment from an excel sheet or add multiple groups to a user per their title from an excel sheet. Hope you check it out and leave some feedback! So much I want to do with it and super excited about this project that I feel can help so many!

I’ll be doing some blog posts and video tutorials in the near future. Any preferences?

Thanks to Andrew Pla for the extra push 😆

https://github.com/DevClate/365AutomatedLab

Tagged With: 365, AD, Automation, Documentation, Module Monday, PowerShell

One-Liner Wednesday July 26, 2023

July 26, 2023 by ClaytonT 1 Comment

Ever needed to check a computer or server and see how much disk space is being used? It could be for multiple reasons such as are any disks too low on space, too much available space assigned(think VMs where you need storage for a new server, but assume all of your storage is tied up), or you just need to see drives that have more than a certain amount of free space due to company standards.

This little one-liner is a great template for you then. This one liner will show any drive on the current computer that has more than 30gb of space free. You could easily change the “-gt” to “-lt” and only show drives with less than 30gb of space free.

Get-PSDrive -PSProvider 'FileSystem' | Where-Object { ($_.Free / 1GB) -gt 30 } | Format-Table -AutoSize

I know your thinking, I can easily click on my computer and check hard drive space, but what about if you have 10, 100, or 1000+ devices you have to manage? Do you really want to do all of those clicks? You could even set this up as a scheduled task and have it notify you, send to teams/discord/etc, or even email a Distribution List with a report. That sounds like a lot better idea than wasting time clicking around.

If your curious on how to have this capture multiple computers, one way is:

$Computers = 'Computer1', 'Computer2', 'Computer3'  # Replace with your computer names or IPs

$ScriptBlock = {
    Get-PSDrive -PSProvider 'FileSystem' | 
    Where-Object { ($_.Free / 1GB) -gt 30 } | 
    Format-Table -AutoSize
}

foreach ($Computer in $Computers) {
    Invoke-Command -ComputerName $Computer -ScriptBlock $ScriptBlock
}

I hope you found this one-liner useful, and would love to hear how you use it or have used it in the past! And as always if you have any questions, please feel free to reach out and if I can’t help you out, and I can find someone that can.

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

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

  • New Feature Announcement for 365AutomatedLab
  • How ChatGPT saved our company $1500 in less than 15 minutes
  • Read-Only Friday August 4, 2023 End Of Life Server 2012R2 and managing EOL
  • One-Liner Wednesday August 2, 2023
  • Module Monday July 31, 2023

Categories

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

© 2023 Clatent