Skip to content

Instantly share code, notes, and snippets.

#Run this script with
#cd ([Environment]::GetFolderPath("Desktop")
#powershell.exe -ExecutionPolicy Bypass -File "srp editor side by side.ps1"
# Load required assemblies
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# Add Windows API functions
Add-Type @"
@jbratu
jbratu / setupiisforsslperfectforwardsecrecy_v17.ps1
Last active January 17, 2025 10:17
Great powershell script for tightening HTTPS security on IIS and disabling insecure protocols and ciphers. Very useful on core installations.
# Copyright 2019, Alexander Hass
# https://www.hass.de/content/setup-microsoft-windows-or-iis-ssl-perfect-forward-secrecy-and-tls-12
#
# After running this script the computer only supports:
# - TLS 1.2
#
# Version 3.0.1, see CHANGELOG.txt for changes.
Write-Host 'Configuring IIS with SSL/TLS Deployment Best Practices...'
Write-Host '--------------------------------------------------------------------------------'
@jbratu
jbratu / CS_RDK_UTIL.oibp
Last active December 26, 2024 13:33
Utility code for working with OpenInsight RDK's. Currently useful for saving an RDK as a file or copying an RDK view (list of things to make and RDK of) to another copy of OpenInsight.
Function CS_RDK_UTIL(inMethod, Param1, Param2, Param3, Param4, outValue,outStat)
/*
Function: CS_RDK_UTIL
--- BP
CS_RDK_UTIL(inMethod, Param1, Param2, Param3, Param4, outValue,outStat)
---
Utility library For working With RDKs
Parameters:
Program:
PowerShell.exe
Arguments:
-ExecutionPolicy Bypass C:\pathtoyour\powershell\script.ps1
#Or if path contains spaces
-ExecutionPolicy Bypass -file "C:\path to your\powershell\script.ps1"
#Or if path contains spaces and parameter
-ExecutionPolicy Bypass -file "C:\path to your\powershell\script.ps1" "YOUR PARAM"
Start in:
C:\path to your\powershell\
@jbratu
jbratu / CS_RESOLVE_TABLE_HANDLE_TO_NAME.oibp
Last active June 19, 2024 23:10
Function accepts and OpenInsight table handle and resolve the handle back to a table name.
Function CS_RESOLVE_TABLE_HANDLE_TO_NAME(OpenTableHandle)
Declare Function List_volume_Sub
/*
Given the example:
Open 'SYSLISTS' To OpenTableHandle Else Debug
TableName = CS_RESOLVE_TABLE_HANDLE_TO_NAME(OpenTableHandle)
The Function will return the name of the table From the handle.
*/
@jbratu
jbratu / powershell-non-domain-remoting.md
Created March 26, 2024 16:16 — forked from cmcginty/powershell-non-domain-remoting.md
Windows Powershell Remoting into Non-Domain Joined System

Powershell Remoting to a Non-Domain Host

  1. From an admin shell, enable PS remoting on the machine you wish to access:
New-ItemProperty -Name LocalAccountTokenFilterPolicy `
  -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System `
  -PropertyType DWord -Value 1

Enable-PsRemoting -Force
@jbratu
jbratu / cs_logger.oibp
Last active March 22, 2024 03:40
Simple OpenInsight logging utility for recording log files from your code.
Function CS_Logger(instance, inMethod, Param1, Param2, Param3, Param4, outValue,outStat)
/*
Function: CS_Logger
>CS_Logger(instance, Param1, Param2, Param3, Param4, outValue,outStat)
Logging Utility.
Parameters:
instance - A previously created log object instance created With the 'Setup' method
@jbratu
jbratu / CS_RLIST_UTIL.oibp
Last active November 22, 2023 02:20
This scratch OpenInsight routine is a wrapper around RLIST that has conditional error trapping and optional progress indicator. I often found myself writing a bunch of boiler plate code to manage the protection of the active select list, progress display, and breaking (or ignoring) errors. This wraps it up to one method and returns a list of key…
Function CS_RLIST_UTIL(inMethod, Param1, Param2, Param3, Param4, outValue,outStat)
/*
Function: CS_RLIST_UTIL
>CS_RLIST_UTIL(inMethod, Param1, Param2, Param3, Param4, outValue,outStat)
Rlist Utility Function For the protection of active cursors, displaying of progress, And error handling.
Parameters:
inMethod - Varies depending On action.
@jbratu
jbratu / OpenInsight List and Select Keywords.md
Last active August 1, 2023 01:16
The authoritative list of OpenList LIST and SELECT statement keywords for OpenInsight is found in the Programmer's Reference Manual under the section 'Appendix A: OpenList Keyword Reference > With'. It's difficult to find when using the help file index or search feature. Below are a few of my favorite examples.

Selecting Data

Executing a select statement will return the number of rows found and set the in memory active list of keys which can be accessed using a list statement.

Select records in table based on key name

@ID contains the name of the record key, use this field in you comparison criteria.

SELECT INVENTORY WITH @ID GT 100 AND @ID LT 200

Select records in table based on a search term in the beginning or ending of a field

@ID contains the name of the record key, use this field in you comparison criteria. For example find all window source code belonging to the EXAMPLES app. The right bracket operator means 'beginning with'.

#Tail a file
get-content -Tail 20 -Wait -path '.\log.txt'
#Tail and grep a file
Get-Content log.txt -tail 20 –wait | Select-String 'look for string'
#Grep a file
get-content -path '.\log.txt' | Select-String 'look for string'
#Move files older than 180 days