This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note that standard binary computing floating point numbers cannot exactly represent simple decimal floating point numbers. | |
# This is the expected behavior for IEEE-754 compliant binary floating point processors | |
# https://en.wikipedia.org/wiki/IEEE_floating_point | |
# Case in point, 0.1 (1/10 = 10^-1) is between 1/8=2^-3 and 1/16=2^-4 | |
# Since binary fraction cannot exacly store 1/10, accuracy of associated arithmetic is adversely impacted | |
# https://docs.python.org/3.5/tutorial/floatingpoint.html | |
# See the following example using Python 3.x | |
def test_binary_fraction(): | |
mySum = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# comment allowed before script param() statement | |
param([Parameter(Mandatory=$true)] $a, $b) | |
$ErrorActionPreference = "Stop" | |
Set-StrictMode -Version Latest | |
"`$a = $a, `$b = $b" | |
$args | |
$MyInvocation | |
$PSBoundParameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: param() MUST BE FIRST STATEMENT in script file!!! | |
param([Parameter(Mandatory=$true)] $csvPath) | |
$ErrorActionPreference = "Stop" | |
Set-StrictMode -Version Latest | |
Import-Module ActiveDirectory | |
# Get the CSV file path from an input parameter ($csvPath) | |
$people = Import-CSV $csvPath | |
# CONVERT EMPTY STRING FIELDS TO $null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Q" | openssl s_client -connect "your.fqdn.com:443" \ | |
| openssl x509 -noout -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This example lacks error checking | |
# late binding, call main AFTER defining check_ssl dependency | |
function main() { check_ssl -fqdn "your.fqdn.com" -port 443 } | |
function check_ssl($fqdn, $port) { | |
$tcpsocket = New-Object Net.Sockets.TcpClient($fqdn, $port) | |
$tcpstream = $tcpsocket.GetStream() | |
$sslStream = New-Object Net.Security.SslStream($tcpstream, $false) | |
$sslStream.AuthenticateAsClient($fqdn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module activedirectory | |
# Substitute correct values in place of * and com below. | |
cd "AD:\CN=Databases,CN=Exchange Administrative Group (*),CN=Administrative Groups,CN=*,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=*,DC=com" | |
get-item * -Properties msExchHomePublicMDB | ` | |
foreach { | |
# Show name of mailbox database | |
$_.Name; | |
if ($_.msExchHomePublicMDB -eq $null) { | |
"NULL PF DB" | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Change the filter and column list as needed to match your query needs. | |
set filter="Disposition = 20,NotAfter > 11/29/2017" | |
set columns="NotAfter,CommonName,DistinguishedName,DispositionMessage,Disposition,CertificateTemplate,NotBefore,SerialNumber" | |
certutil -view -restrict %filter% -out %columns% >certutil_view_issued_notexpired.txt | |
REM see https://blogs.technet.microsoft.com/pki/2008/10/03/disposition-values-for-certutil-view-restrict-and-some-creative-samples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
# Put usernames one-per-line in a text (CSV) file with header first-line: Username | |
# Set this to the path of your input csv file. | |
$CSVFilePath = "TroubleUsers.csv" | |
# This script will Clear the adminCount property and Enable Inheritance on the object Access Control List (ACL) in AD | |
$users = import-csv $CSVFilePath | sort Username | |
$groups = @() | |
foreach ($user in $users) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change the filter and column list as needed to match your query needs. | |
# Query Active Directory Certificate Services for Certs issued to given hostname | |
function view_certs($prefix, $config=$null) { | |
# call like: view_certs -prefix "srv-name" | |
# Find $config value by running "certutil" with NO OPTIONS | |
# increment last character to get next prefix (stop matching) | |
$nextprefix = $prefix.Remove($prefix.Length-1) + [char]([int]$prefix[-1] + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Based on Stack Overflow Answer by @Fionnuala | |
' https://stackoverflow.com/questions/12606326/linked-table-ms-access-2010-change-connection-string | |
' NOTE: If a linked table is no longer valid, delete it and Restart Access or Compact the database | |
Function ChangeODBCDriver() | |
Dim tdf As TableDef | |
Dim oldDriver As String, newDriver As String | |
oldDriver = "SQL Server Native Client 10.0" | |
newDriver = "ODBC Driver 17 for SQL Server" | |
For Each tdf In CurrentDb.TableDefs | |
If tdf.Connect <> vbNullString Then |
OlderNewer