This repo contains a collection of generally useful scripts (mostly Windows, mostly PowerShell).
- Add-CapturesToMatches.ps1: Adds named capture groups as note properties to Select-String's MatchInfo objects.
- Add-GitHubMetadata.ps1: Adds GitHub Linguist overrides to a repo's .gitattributes.
- Add-Utf8Signature.ps1: Adds the utf-8 signature (BOM) from a file.
- Add-VsCodeDatabaseConnection.ps1: Adds a VS Code MSSQL database connection to the repo.
- Add-Xml.ps1: Insert XML into an XML document relative to a node found by Select-Xml.
- Backup-File.ps1: Create a backup as a sibling to a file, with date and time values in the name.
- Backup-SchTasks.ps1: Exports the local list of Scheduled Tasks into a single XML file.
- Convert-ScheduledTasksToJobs.ps1: Converts Scheduled Tasks to Scheduled Jobs.
- ConvertFrom-DataRow.ps1: Converts a DataRow object to a PSObject.
- ConvertFrom-EscapedXml.ps1: Parse escaped XML into XML and serialize it.
- ConvertFrom-UserAgent.ps1: Parse an HTTP User-Agent string.
- ConvertFrom-XmlElement.ps1: Converts named nodes of an element to properties of a PSObject, recursively.
- ConvertTo-BasicAuthentication.ps1: Produces a basic authentication header string from a credential.
- ConvertTo-LogParserTimestamp.ps1: Formats a datetime as a LogParser literal.
- ConvertTo-OrderedDictionary.ps1: Converts an object to an ordered dictionary of properties and values.
- Copy-SchTasks.ps1: Copy scheduled jobs from another computer to this one, using a GUI list to choose jobs.
- Disable-NetStrongCrypto.ps1: Disable strong crypto for .NET 3.5 & 4.5.
- Enable-NetStrongCrypto.ps1: Enable strong crypto for .NET 3.5 & 4.5.
- Export-DatabaseObjectScript.ps1: Exports MS SQL script for an object from the given server.
- Export-DatabaseScripts.ps1: Exports MS SQL database objects from the given server and database as files, into a consistent folder structure.
- Export-Readme.ps1: Generate README.md file for the scripts repo.
- Export-ScheduledJobs.ps1: Exports scheduled jobs as a PowerShell script that can be run to restore them.
- Export-ScheduledTasks.ps1: Exports scheduled tasks as a PowerShell script that can be run to restore them.
- Export-Server.ps1: Exports web server settings, shares, ODBC DSNs, and installed MSAs as PowerShell scripts and data.
- Export-SmbShares.ps1: Export SMB shares using old NET SHARE command, to new New-SmbShare PowerShell commands.
- Export-TableMerge.ps1: Exports table data as a T-SQL MERGE statement.
- Export-WebConfiguration.ps1: Exports IIS websites, app pools, and web apps as an idempotent PowerShell script to recreate them.
- Find-Certificate.ps1: Searches a certificate store for certificates.
- Find-Lines.ps1: Searches a specific subset of files for lines matching a pattern.
- Find-NewestFile.ps1: Finds the most recent file.
- Find-ProjectPackages.ps1: Find modules used in projects.
- Find-SqlDeprecatedLargeValueTypes.ps1: Reports text, ntext, and image datatypes found in a given database.
- Format-ByteUnits.ps1: Converts bytes to largest possible units, to improve readability.
- Format-HtmlDataTable.ps1: Right-aligns numeric data in an HTML table for emailing, and optionally zebra-stripes &c.
- Format-PSLiterals.ps1: Serializes complex content into PowerShell literals.
- Format-Xml.ps1: Pretty-print XML.
- Format-XmlElements.ps1: Serializes complex content into XML elements.
- Get-AspNetEvents.ps1: Parses ASP.NET errors from the event log on the given server.
- Get-AssemblyFramework.ps1: Gets the framework version an assembly was compiled for.
- Get-CertificatePath.ps1: Gets the physical path on disk of a certificate.
- Get-CertificatePermissions.ps1: Returns the permissions of a certificate's private key file.
- Get-CharacterDetails.ps1: Returns filterable categorical information about characters in the Unicode Basic Multilingual Plane.
- Get-ClassicAspEvents.ps1: Gets Classic ASP errors from the event log on the given server.
- Get-CommandPath.ps1: Locates a command.
- Get-ConfigConnectionStringBuilders.ps1: Return named connection string builders for connection strings in a config file.
- Get-ContentSecurityPolicy.ps1: Returns the content security policy at from the given URL.
- Get-Dns.ps1: Looks up DNS info, given a hostname or address.
- Get-EnumValues.ps1: Returns the possible values of the specified enumeration.
- Get-IisLog.ps1: Easily query IIS logs.
- Get-LibraryVulnerabilityInfo.ps1: Get the list of module/package/library vulnerabilities from the RetireJS or SafeNuGet projects.
- Get-NetFrameworkVersions.ps1: Determine which .NET Frameworks are installed on the requested system.
- Get-SslDetails.ps1: Enumerates the SSL protocols that the client is able to successfully use to connect to a server.
- Get-SystemDetails.ps1: Collects some useful system hardware and operating system details via WMI.
- Get-TypeAccelerators.ps1: Returns the list of PowerShell type accelerators.
- Grant-CertificateAccess.ps1: Grants certificate file read access to an app pool or user.
- Import-Variables.ps1: Creates local variables from a data row or dictionary (hashtable).
- Import-VsCodeDatabaseConnections.ps1: Adds config XDT connection strings to VSCode settings.
- Install-ActiveDirectoryModule.ps1: Durably installs the PowerShell ActiveDirectory module.
- Install-SqlServerModule.ps1: Installs SqlServer module and dependencies.
- Invoke-CommandWithParams.ps1: Execute a command by using matching dictionary entries as parameters.
- Join-FileName.ps1: Combines a filename with a string.
- Measure-Indents.ps1: Measures the indentation characters used in a text file.
- Measure-StandardDeviation.ps1: Calculate the standard deviation of numeric values.
- New-DbProviderObject.ps1: Create a common database object.
- New-Shortcut.ps1: Create a Windows shortcut.
- Optimize-Path.ps1: Sorts, prunes, and normalizes both user and system Path entries.
- Read-Choice.ps1: Returns choice selected from a list of options.
- Remove-LockyFile.ps1: Removes a file that may be prone to locking.
- Remove-Utf8Signature.ps1: Removes the utf-8 signature (BOM) from a file.
- Remove-WebAppHostCruft.ps1: Removes unused web application settings that have accumulated.
- Remove-Xml.ps1: Removes a node found by Select-Xml from its XML document.
- Repair-DatabaseConstraintNames.ps1: Finds database constraints with system-generated names and gives them deterministic names.
- Repair-DatabaseUntrustedConstraints.ps1: Finds database constraints that have been incompletely re-enabled.
- Restore-SchTasks.ps1: Imports from a single XML file into the local Scheduled Tasks.
- Save-WebRequest.ps1: Downloads a given URL to a file, automatically determining the filename.
- Select-DictionaryKeys.ps1: Constructs an OrderedDictionary by selecting keys from a given IDictionary.
- Select-XmlNodeValue.ps1: Returns the value of an XML node found by Select-Xml.
- Send-MailMessageFile.ps1: Sends emails from a drop folder using .NET config defaults.
- Send-SeqEvent.ps1: Send an event to a Seq server.
- Send-SeqScriptEvent.ps1: Sends an event (often an error) from a script to a Seq server, including script info.
- Send-SqlReport.ps1: Execute a SQL statement and email the results.
- Set-DefaultSecurityProtocols.ps1: Enable TLS versions in Outlook on Windows 7.
- Set-XmlAttribute.ps1: Adds an XML attribute to an XML element found by Select-Xml.
- Set-XmlNodeValue.ps1: Sets the value of a node found by Select-Xml.
- Show-CertificatePermissions.ps1: Shows the permissions of a certificate's private key file.
- Show-DataRef.ps1: Display an HTML view of an XML schema or WSDL using Saxon.
- Split-FileName.ps1: Returns the specified part of the filename.
- Test-DateTime.ps1: Tests whether the given string can be parsed as a date.
- Test-FileTypeMagicNumber.ps1: Tests for a given common file type by magic number.
- Test-HttpSecurity.ps1: Scan sites using Mozilla's Observatory.
- Test-Interactive.ps1: Determines whether both the user and process are interactive.
- Test-MagicNumber.ps1: Tests a file for a "magic number" (identifying sequence of bytes) at a given location.
- Test-NewerFile.ps1: Returns true if the difference file is newer than the reference file.
- Test-USFederalHoliday.ps1: Returns true if the given date is a U.S. federal holiday.
- Test-Xml.ps1: Try parsing text as XML.
- Update-Files.ps1: Copies specified source files that exist in the destination directory.
- Use-Command.ps1: Checks for the existence of the given command, and adds if missing and a source is defined.
- Use-NetMailConfig.ps1: Use .NET configuration to set defaults for Send-MailMessage.
- Use-ReasonableDefaults.ps1: Sets certain cmdlet parameter defaults to rational, useful values.
- Use-SeqServer.ps1: Set the default Server and ApiKey for Send-SeqEvent.ps1
- Use-SqlcmdParams.ps1: Use the calling script parameters to set Invoke-Sqlcmd defaults.
- Use-SystemCrypto.ps1: Sets the .NET Frameworks prior to 4.7.1 to inherit the system TLS settings.
- ExampleEmailReport.fsx: Builds a chart and attaches it to an email, then sends it.
- US Federal Holiday Detection: Here's how to determine whether a date is a US federal holiday using F#.
- OutlookExpireTag.vba: Too many emails remain beyond their period of relevance: daily personnel schedule changes, found item notices, office food notices, server reboot notices, weather/traffic warnings, &c. This Outlook script will allow specifying an expiration date as a hashtag in the subject of outgoing emails, since Outlook does such a good job of hiding the UI for that field. -BL
- OutlookPasteFormattedIndented.vba: Outlook will strip single-space indents when displaying emails. If you've got, for example, syntax highlighted source code that employs any indentation of only one space, you'll want to add two spaces to the each line (adding one will not appear for text that isn't indented). This Outlook script will paste formatted text, and indent it. Requires Tools -> References -> Microsoft Word 14.0 Object Library (later versions may also work)
- OutlookPasteTsvTable.vba: This Outlook VBA Sub can be connected to a toolbar button for pasting TSV data as an attractive, formatted table. -BL Requires Tools -> References -> Microsoft Word 14.0 Object Library (later versions may also work)