r/PowerShell • u/JohnSavill • Jun 30 '21
Information Just passed 250,000 views of lesson 1 of the PowerShell Master Class. Just wanted to say thanks!
r/PowerShell • u/JohnSavill • Jun 30 '21
r/PowerShell • u/MadBoyEvo • Feb 20 '19
r/PowerShell • u/e-motio • Jun 23 '25
I know there’s better tools for automating deployments, but I work for a big MSP and I don’t get direct access to those tools. But I am a big fan of Infrastructure as code, and I’m close to applying that to windows deployments. To the PS pros, I’m sure JSON is no big deal, but I’m having fun with it. I think I’m going to end up using these principles to extend out of workstation deployment into other IaC projects.
r/PowerShell • u/Crimson_89 • Feb 10 '19
r/PowerShell • u/3d-david • Nov 20 '20
I got laid off at the start of Covid. During my unemployment, I kept busy by working on a project I call "DDD" (3D). DDD is a module that makes points, vectors, and matrices data types that can be displayed by piping them to an Out-3d command.
I got my project to a point where I can demo it and you can try it out too. I wrote about the preview release in my blog:
http://www.davidlenihan.com/2020/11/08/preview-release-of-ddd/
r/PowerShell • u/CodingCaroline • Sep 16 '20
r/PowerShell • u/gandhiN • Oct 12 '19
r/PowerShell • u/mdj_ • May 22 '20
Driven by a previous post I wrote on ICMP, I've spent a bunch of time looking at reliably detecting devices on a network that may have firewalls blocking pings. There's a bunch of other tools that do this (arpping for one), but I haven't seen anything in PowerShell. Ended up with a pretty cool solution that can scan a whole /24 in well under a second.
https://xkln.net/blog/layer-2-host-discovery-with-powershell-in-under-a-second/
Discovered a bunch of other interesting stuff in the process, that's in there too... how long you do think Start-Sleep -Milliseconds 1 takes? :)
Edit: This seems to be getting a bit of interest, so to make it a more convenient I've put it up on GitHub and PowerShell Gallery.
r/PowerShell • u/Techplained • Dec 08 '22
If you haven’t tried it yet, do it.
It just helped me solve an issue where I couldn’t think of a way to structure some data.
I then I asked if it was the best method and it gave me a better solution using json.net.
Finally I asked it how the method differed and it explained it incredibly well.
I’m gob smacked!!
r/PowerShell • u/TwinkleTwinkie • Nov 24 '21
r/PowerShell • u/MadBoyEvo • Sep 08 '19
Some time ago I've decided I'm a bit too lazy for manual verification of my Active Directory when it comes to doing Health Checks. I've caught myself a few times where I've configured 4 out of 5 Domain Controllers thinking everything is running great. While there are "pay" tools on the market I've usually no budget. And when you search for Active Directory Health Checks you can find a lot of blog posts covering Active Directory Health Checks. However, everyone treats every health check separately. If you want to test 20 different things you're gonna spend next 8 hours doing just that. And when you're done you should start all over the next day because something may have changed.
I wrote a PowerShell module called Testimo which bundles a lot of Active Directory checks and make it easy to expand on. It targets Forest/Domain and all it's Domain Controllers. It has reporting built-in. It's able to work ad-hoc to asses someone else directory and find what's misconfigured, but also has advanced configured which can test your AD against given specific settings.
Following "health" checks are added for now. I do intend to add more as I go. It's quite easy to add more sources/tests so if you wanna help out - please do. Of course, I may have done a few misconfigurations, some errors while putting it all together - so make sure to let me know via GitHub issues if you think some settings are incorrect and should be changed.
Forest Backup – Verify last backup time should be less than X days
Forest Replication – Verify each DC in replication site can reach other replication members
Forest Optional Features – Verify Optional Feature Recycle Bin should be Enabled
Forest Optional Features- Verify Optional Feature Privileged Access Management Feature should be Enabled
Forest Optional Features – Verify Optional Feature Laps should be enabled Configured
Forest Sites Verification Verify each site has at least one subnet configured
Forest Sites Verification Verify each site has at least one domain controller configured
Forest Site Links – Verify each site link is automatic
Forest Site Links – Verify each site link uses notifications
Forest Site Links- Verify each site link does not use notifications
Forest Roles Verify each FSMO holder is reachable
Forest Orphaned/Empty Admins – Verify there are no Orphaned Admins (users/groups/computers)
Forest Tombstone Lifetime – Verify Tombstone lifetime is greater or equal 180 days
Domain Roles Verify each FSMO holder is reachable
Domain Password Complexity Requirements – Verify Password Complexity Policy should be Enabled
Domain Password Complexity Requirements – Verify Password Length should be greater than X
Domain Password Complexity Requirements – Verify Password Threshold should be greater than X
Domain Password Complexity Requirements – Verify Password Lockout Duration should be greater than X minutes
Domain Password Complexity Requirements – Verify Password Lockout Observation Window should be greater than X minutes
Domain Password Complexity Requirements – Verify Password Minimum Age should be greater than X
Domain Password Complexity Requirements – Verify Password History Count should be greater than X
Domain Password Complexity Requirements – Verify Password Reversible Encryption should be Disabled
Domain Trust Availability – Verify each Trust status is OK
Domain Trust Unconstrained TGTDelegation – Verify each Trust TGTDelegation is set to True
Domain Kerberos Account Age – Verify Kerberos Last Password Change Should be less than 180 days
Domain Groups: Account Operators – Verify Group is empty
Domain Groups: Schema Admins – Verify Group is empty
Domain User: Administrator – Verify Last Password Change should be less than 360 days or account disabled
Domain DNS Forwarders – Verify DNS Forwarders are identical on all DNS nodes
Domain DNS Scavenging Primary DNS Server – Verify DNS Scavenging is set to X days
Domain DNS Scavenging Primary DNS Server – Verify DNS Scavenging State is set to True
Domain DNS Scavenging Primary DNS Server – Verify DNS Scavenging Time is less than X days
Domain DNS Zone Aging – Verify DNS Zone Aging is set
Domain Well known folder – UsersContainer Verify folder is not at it's defaults.
Domain Well known folder – ComputersContainer Verify folder is not at it's defaults.
Domain Well known folder – DomainControllersContainer Verify folder is at it's defaults.
Domain Well known folder – DeletedObjectsContainer Verify folder is at it's defaults.
Domain Well known folder – SystemsContainer Verify folder is at it's defaults.
Domain Well known folder – LostAndFoundContainer Verify folder is at it's defaults.
Domain Well known folder – QuotasContainer Verify folder is at it's defaults.
Domain Well known folder – ForeignSecurityPrincipalsContainer Verify folder is at it's defaults.
Domain Orphaned Foreign Security Principals – Verify there are no orphaned FSP objects.
Domain Orphaned/Empty Organizational Units – Verify there are no orphaned Organizational Units
Domain Group Policy Missing Permissions – Verify Authenticated Users/Domain Computers are on each and every Group Policy
Domain DFSR Sysvol – Verify SYSVOL is DFSR
Domain Controller Information – Is Enabled
Domain Controller Information – Is Global Catalog
Domain Controller Service Status – Verify all Services are running
Domain Controller Service Status – Verify all Services are set to automatic startup
Domain Controller Service Status (Print Spooler) – Verify Print Spooler Service is set to disabled
Domain Controller Service Status (Print Spooler) – Verify Print Spooler Service is stopped
Domain Controller Ping Connectivity – Verify DC is reachable
Domain Controller Ports – Verify Following ports 53, 88, 135, 139, 389, 445, 464, 636, 3268, 3269, 9389 are open
Domain Controller RDP Ports – Verify Following ports 3389 (RDP) is open
Domain Controller RDP Security – Verify NLA is enabled
Domain Controller LDAP Connectivity – Verify all LDAP Ports are open
Domain Controller LDAP Connectivity – Verify all LDAP SSL Ports are open
Domain Controller Windows Firewall – Verify windows firewall is enabled for all network cards
Domain Controller Windows Remote Management – Verify Windows Remote Management identification requests are managed
Domain Controller Resolves internal DNS queries – Verify DNS on DC resolves Internal DNS
Domain Controller Resolves external DNS queries – Verify DNS on DC resolves External DNS
Domain Controller Name servers for primary domain zone Verify DNS Name servers for primary zone are identical
Domain Controller Responds to PowerShell Queries Verify DC responds to PowerShell queries
Domain Controller TimeSettings – Verify PDC should sync time to external source
Domain Controller TimeSettings – Verify Non-PDC should sync time to PDC emulator
Domain Controller TimeSettings – Verify Virtualized DCs should sync to hypervisor during boot time only
Domain Controller Time Synchronization Internal – Verify Time Synchronization Difference to PDC less than X seconds
Domain Controller Time Synchronization External – Verify Time Synchronization Difference to pool.ntp.org less than X seconds
Domain Controller Disk Free – Verify OS partition Free space is at least X %
Domain Controller Disk Free – Verify NTDS partition Free space is at least X %
Domain Controller Operating System – Verify Windows Operating system is Windows 2012 or higher
Domain Controller Windows Updates – Verify Last patch was installed less than 60 days ago
Domain Controller SMB Protocols – Verify SMB v1 protocol is disabled
Domain Controller SMB Protocols – Verify SMB v2 protocol is enabled
Domain Controller SMB Shares – Verify default SMB shares NETLOGON/SYSVOL are visible
Domain Controller DFSR AutoRecovery – Verify DFSR AutoRecovery is enabled
Domain Controller Windows Roles and Features – Verify Windows Features for AD/DNS/File Services are enabled
I welcome all good/bad feedback.
- blog post with description: https://evotec.xyz/what-do-we-say-to-health-checking-active-directory/
- sources: https://github.com/EvotecIT/Testimo
It's an alpha product - but I've tested it on 3-4 AD's I have and so far it works ok. I've probably missed some things so if you find some bugs please let me know.
r/PowerShell • u/Mc_Humphrey • Oct 31 '21
I personally do, but only for typing scripts. I then copy code into ISE and run it on Sandbox environments.
What does everyone else do? What settings do you use if you use VS Code?
r/PowerShell • u/ThomasMaurerCH • Dec 08 '20
r/PowerShell • u/wrtbwtrfasdf • Nov 07 '19
r/PowerShell • u/MadBoyEvo • May 12 '19
I wanted to introduce you today to my new PowerShell module. Actually a couple of them, and to remind you a bit about my other PowerShell modules. Hope you like this one. This PowerShell module is able to extract Active Directory data as can be seen below. If you want to find out more: https://evotec.xyz/what-do-we-say-to-writing-active-directory-documentation/
It covers usage, code explanation, examples, and a few other things. Generally all the know/how (no ads/no pay software). It's free and open source. All of it.
Links to sources:
PSWinDocumentation.AD - https://github.com/EvotecIT/PSWinDocumentation.AD - the module that provides all the Active Directory data as one command.
Dashimo - https://github.com/EvotecIT/Dashimo - a module that is able to wrap that data into HTML
Emailimo - https://github.com/EvotecIT/Emailimo - a module that is able to wrap that data into Email and send it over
Documentimo - https://github.com/EvotecIT/Documentimo - a module that is able to wrap that data into WORD document (no word required)
Excelimo - https://github.com/EvotecIT/Excelimo - a module that is able to wrap that data into EXCEL document
Example output
HTML Version: https://evotec.xyz/wp-content/uploads/2019/05/DashboardActiveDirectory.html
DocX Version: https://evotec.xyz/wp-content/uploads/2019/05/Starter-AD.docx
Xlsx Version: https://evotec.xyz/wp-content/uploads/2019/05/Run-Demo02-1.xlsx (minimal)
Small code sample 1:
$Forest = Get-WinADForestInformation -Verbose -PasswordQuality
$ForestSmall code sample 2:
$Forest = Get-WinADForestInformation -Verbose -PasswordQuality
$Forest.FoundDomains
$Forest.FoundDomains.'ad.evotec.xyz'Small code sample 3:
$Forest = Get-WinADForestInformation -Verbose -PasswordQuality -DontRemoveSupportData -TypesRequired DomainGroups -Splitter "`r`n"
$ForestYou can install it using:
Install-Module PSWinDocumentation.AD -ForceForestInformation
ForestFSMO
ForestGlobalCatalogs
ForestOptionalFeatures
ForestUPNSuffixes
ForestSPNSuffixes
ForestSites
ForestSites1
ForestSites2
ForestSubnets
ForestSubnets1
ForestSubnets2
ForestSiteLinks
ForestDomainControllers
ForestRootDSE
ForestSchemaPropertiesUsers
ForestSchemaPropertiesComputers
DomainRootDSE
DomainRIDs
DomainAuthenticationPolicies
DomainAuthenticationPolicySilos
DomainCentralAccessPolicies
DomainCentralAccessRules
DomainClaimTransformPolicies
DomainClaimTypes
DomainFineGrainedPolicies
DomainFineGrainedPoliciesUsers
DomainFineGrainedPoliciesUsersExtended
DomainGUIDS
DomainDNSSRV
DomainDNSA
DomainInformation
DomainControllers
DomainFSMO
DomainDefaultPasswordPolicy
DomainGroupPolicies
DomainGroupPoliciesDetails
DomainGroupPoliciesACL
DomainOrganizationalUnits
DomainOrganizationalUnitsBasicACL
DomainOrganizationalUnitsExtendedACL
DomainContainers
DomainTrustsClean
DomainTrusts
DomainBitlocker
DomainLAPS
DomainGroupsFullList
DomainGroups
DomainGroupsMembers
DomainGroupsMembersRecursive
DomainGroupsSpecial
DomainGroupsSpecialMembers
DomainGroupsSpecialMembersRecursive
DomainGroupsPriviliged
DomainGroupsPriviligedMembers
DomainGroupsPriviligedMembersRecursive
DomainUsersFullList
DomainUsers
DomainUsersCount
DomainUsersAll
DomainUsersSystemAccounts
DomainUsersNeverExpiring
DomainUsersNeverExpiringInclDisabled
DomainUsersExpiredInclDisabled
DomainUsersExpiredExclDisabled
DomainAdministrators
DomainAdministratorsRecursive
DomainEnterpriseAdministrators
DomainEnterpriseAdministratorsRecursive
DomainComputersFullList
DomainComputersAll
DomainComputersAllCount
DomainComputers
DomainComputersCount
DomainServers
DomainServersCount
DomainComputersUnknown
DomainComputersUnknownCount
DomainPasswordDataUsers
DomainPasswordDataPasswords
DomainPasswordDataPasswordsHashes
DomainPasswordClearTextPassword
DomainPasswordClearTextPasswordEnabled
DomainPasswordClearTextPasswordDisabled
DomainPasswordLMHash
DomainPasswordEmptyPassword
DomainPasswordWeakPassword
DomainPasswordWeakPasswordEnabled
DomainPasswordWeakPasswordDisabled
DomainPasswordWeakPasswordList
DomainPasswordDefaultComputerPassword
DomainPasswordPasswordNotRequired
DomainPasswordPasswordNeverExpires
DomainPasswordAESKeysMissing
DomainPasswordPreAuthNotRequired
DomainPasswordDESEncryptionOnly
DomainPasswordDelegatableAdmins
DomainPasswordDuplicatePasswordGroups
DomainPasswordHashesWeakPassword
DomainPasswordHashesWeakPasswordEnabled
DomainPasswordHashesWeakPasswordDisabled
DomainPasswordStats
And just a small update on my Find-Events command... I've added one more report Organizational Unit Changes (move/add/remove). So the default list now covers:
ADComputerChangesDetailed
ADComputerCreatedChanged
ADComputerDeleted
ADGroupChanges
ADGroupChangesDetailed
ADGroupCreateDelete
ADGroupEnumeration
ADGroupMembershipChanges
ADGroupPolicyChanges
ADLogsClearedOther
ADLogsClearedSecurity
ADUserChanges
ADUserChangesDetailed
ADUserLockouts
ADUserLogon
ADUserLogonKerberos
ADUserStatus
ADUserUnlocked
ADOrganizationalUnitChangesDetailed (added in 2.0.10)
I've also added Credentials parameter which should provide a way for you to use a command from normal user PowerShell prompt. If you have no clue about that command yet - have a read here: https://evotec.xyz/the-only-powershell-command-you-will-ever-need-to-find-out-who-did-what-in-active-directory/ otherwise:
Update-Module PSWinReportingV2Enjoy :-)





r/PowerShell • u/bigbirdtoejam • Apr 13 '17
Have a coworker who habitually leaves their workstation unlocked? Want to mess with them? Make this script a scheduled task on their computer in order to have their workstation tell them a random fact about cats at random times throughout the day.
#Run this every 1/2 hour and in an 8 hour work day there will be approximately 3 times per day that your victim hears a cat fact
if ((Get-Random -Maximum 10000) -lt 1875) {
Add-Type -AssemblyName System.Speech
$SpeechSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$CatFact = (ConvertFrom-Json (Invoke-WebRequest -Uri 'http://catfacts-api.appspot.com/api/facts')).facts
$SpeechSynth.Speak("did you know?")
$SpeechSynth.Speak($CatFact)
} Who else has powershell hijinks to share?
r/PowerShell • u/yanni99 • Mar 14 '18
#This is my first real script and I am really proud of it. Please tell me what you think.
#You need to have Active Directory modules install and Global Admin Access to Office 365
#You also need an AD "OU" that you have synchronized in Azure AD Connect
Import-Module ActiveDirectory
$MsolCreds = Get-Credential -Credential '****@domain.com'
Write-Host "What is the user givenname?" -ForegroundColor Green
$Givenname = Read-Host
Write-Host "What is the user surname?" -ForegroundColor Green
$Surname = Read-host
Write-Host "What is the user department" -ForegroundColor Green
$Department = Read-Host
Write-Host "What is the user job description" -ForegroundColor Green
$Description = Read-Host
Write-Host "Copy access from?" -ForegroundColor Green
$CopyAccess = Read-Host
Write-Host "New user password?" -ForegroundColor Green
$Password = Read-Host -AsSecureString
$Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password))
#Now for the Username you can customize to your needs, this one does 1st letter of $Givename plus $Surname
$Username = $Givenname.Substring(0, 1)+$Surname
$Email = "[email protected]"
$defpassword = (ConvertTo-SecureString "$Password" -AsPlainText -force)
$CopiedAccess = "[email protected]"
$OU = "Your New User OU"
New-ADUser -SamAccountName $Username -AccountPassword $defpassword -UserPrincipalName "$Email" -Surname $Surname -GivenName $Givenname -EmailAddress "$Email" -Enabled $True -ChangePasswordAtLogon $False -DisplayName "$GivenName $Surname" -Name "$GivenName $Surname" -Path $OU -Department $Department -Description $Description -OfficePhone "(888)888-8888"
#For this next step to work, you need to have enabled PSremoting in the server
$AADServer = "Your server where Azure AD Connect is installed"
$Session = New-PSSession -computerName $AADServer
Invoke-Command -Session $Session -ScriptBlock {Start-ADSyncSyncCycle -Policytype Delta}
Remove-PSSession $Session
Get-ADUser -Identity $CopyAccess -Properties memberof |
Select-Object -ExpandProperty memberof |
Add-ADGroupMember -Members $Username
Remove-PSSession $Session
Start-Sleep -Seconds 75
#Here you need to find your O365 country code and the licenses you want to use with Get-AccountSku. Me I only have one I use.
#If you want I can probalby easily get the license from the user thet this on is copied from and assign them automatically
#Of course you have to provision licenses before you exeute the script
Connect-MsolService -Credential $MsolCreds
Set-MsolUser -UserPrincipalName $Email -UsageLocation "CA"
Set-MsolUserLicense -UserPrincipalName $Email -AddLicenses "O365:License"
$MsolSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell -Credential $MsolCreds -Authentication Basic -AllowRedirection
Import-PSSession $MsolSession -AllowClobber
#This copies Shared Mailbox
$CopyMailbox = Get-Mailbox |
Get-MailboxPermission -User $CopiedAccess |
Select-Object -ExpandProperty identity
Foreach ($Mailbox in $CopyMailbox) {Add-MailboxPermission -AccessRights FullAccess -Identity $Mailbox -User $Email -InheritanceType All}
#This Copies O365 Distribution Lists
$CopyDLMailbox = Get-Mailbox $CopiedAccess
$DN = $CopyDLMailbox.DistinguishedName
$Filter = "Members -like ""$DN"""
$DLMailbox = Get-Recipient -ResultSize Unlimited -Filter $Filter -RecipientTypeDetails MailUniversalDistributionGroup |
Select-Object -ExpandProperty Identity
ForEach ($IDMailbox in $DLMailbox) {Add-DistributionGroupMember -Identity "$IDMailbox" -Member "$Email" -BypassSecurityGroupManagerCheck}
#This Copies O365 Office365 Groups
$CopyO365Mailbox = Get-Mailbox $CopiedAccess
$DNO365 = $CopyO365Mailbox.DistinguishedName
$FilterO365 = "Members -like ""$DNO365"""
$O365Mailbox = Get-Recipient -ResultSize Unlimited -Filter $FilterO365 -RecipientTypeDetails GroupMailbox |
Select-Object -ExpandProperty Identity
ForEach ($MailboxO365 in $O365Mailbox) {Add-UnifiedGroupLinks -Identity "$MailboxO365" -LinkType Members -Links "$Email"}
#If you think it is missing something please tell mer/PowerShell • u/hackoofr • May 05 '21
# Happy Birthday song with Beep tones in Powershell Script
cls
$BeepList = @(
@{ Pitch = 1059.274; Length = 300; };
@{ Pitch = 1059.274; Length = 200; };
@{ Pitch = 1188.995; Length = 500; };
@{ Pitch = 1059.274; Length = 500; };
@{ Pitch = 1413.961; Length = 500; };
@{ Pitch = 1334.601; Length = 950; };
@{ Pitch = 1059.274; Length = 300; };
@{ Pitch = 1059.274; Length = 200; };
@{ Pitch = 1188.995; Length = 500; };
@{ Pitch = 1059.274; Length = 500; };
@{ Pitch = 1587.117; Length = 500; };
@{ Pitch = 1413.961; Length = 950; };
@{ Pitch = 1059.274; Length = 300; };
@{ Pitch = 1059.274; Length = 200; };
@{ Pitch = 2118.547; Length = 500; };
@{ Pitch = 1781.479; Length = 500; };
@{ Pitch = 1413.961; Length = 500; };
@{ Pitch = 1334.601; Length = 500; };
@{ Pitch = 1188.995; Length = 500; };
@{ Pitch = 1887.411; Length = 300; };
@{ Pitch = 1887.411; Length = 200; };
@{ Pitch = 1781.479; Length = 500; };
@{ Pitch = 1413.961; Length = 500; };
@{ Pitch = 1587.117; Length = 500; };
@{ Pitch = 1413.961; Length = 900; };
);
# I Just added this For..loop in order to listen the beep tones twice (-_°)
For ($i=1; $i -le 2; $i++) {
foreach ($Beep in $BeepList) {
[System.Console]::Beep($Beep['Pitch'], $Beep['Length']);
}
}r/PowerShell • u/derekhans • Jun 11 '23
With community feedback, PowerShell will be going Private on June 12th through the 14th to participate in the coordinated protest of Reddit API changes.
If you have any questions, feel free to message the mod team.
r/PowerShell • u/TheCallOfAsheron • Jun 15 '19
Hello everyone,
I picked up PowerShell in the last year and pieced together a little tool that served as a project to learn as well as something I used daily and wanted to share what I built. I removed my companies name and internal links, so you may find specific buttons or links that won't function - for example the Active Directory related stuff would need to be pointed at your AD. I'm not an expert but I think there is some useful/fun things in there that someone else may be able to use in their own IT environment. Would love to hear any comments or thoughts on it!
Some of my favorite functions..
- The Local Admin tool lets you add a user to a remote PC's local admin group AND set a timer to remove them (via task scheduler)
- The Message button sends a pop-up message to a remote computer
- The speech button.. un-mutes, sets volume to 100%, and sends a customer text-to-speech message to a remote computer. For legitimate business functions only of course.
- The compare user groups button lets you compare 2 AD user's and if you want you can add user 1 into all of user 2's groups (mirror access).
Photo of the tool's different tabs: https://imgur.com/a/eYQXuPg
The first 3 tools on the tool tab are unfinished I think.. been a while.. but may be some good code there anyway. Let me know what you think!
r/PowerShell • u/lapintana • Mar 07 '20
This script allows us to locate any of our wifi enabled devices by its MAC address at anyone of 12 remote locations. It does this by connecting to our wifi system's API. This script turns what use to be a 10-30 min process per device, into a 15-20 second process. But now the 15-20 seconds is too long for people to wait, which is the reason I'm posting here. I know I am probably doing several things very inefficiently. Most actions are repeated 12 times (once for each site) which gives the script its length. Also the meraki api can handle up to 5 api calls a second. I'm only running one at a time. If anyone can point out what my inefficiencies are, and can offer me any guidance on making this script more efficient, i'd greatly appreciate it!
Here is what it basically does (not every step is listed, these are the majors things)
Gets mac address from text file (another program puts it there)
Connects to api to check if mac address is present on site networks x12 ( once for each site, as each site has a unique api connection it has to do)
writes the results to a text file x12
references text files to get the mac of AP it connected to x12
gets unix time of last connection x12
goes through process of changing unix time to normal time x12
reconnects to api x12 (this time to get access point info and not device info)
goes through process to get the name of AP x12
throws it all into a pretty html table that tells us the last access point it connected to and the time of the connection
Here is a link to the script - https://pastebin.com/x5bbGW9t
Edit: Thank you for all the help I’m getting! So many helpful posts and suggestions that have really taught me a lot and that have given me many areas to improve in
r/PowerShell • u/giuscond • Mar 27 '22