PostgreSQL Allow listing – Adding IP’s to Databases by CRN or by Name
PowerShellPosse
by crshnbrn66
1y ago
The purpose of this article is to demonstrate how a function was created to get the current allow listing information for PostgreSQL in IBMCloud. To begin with in order to perform this allow listing on IBM cloud it is assumed that you’ve already installed the IBMCloud Command Line Interface (CLI) (IBM Cloud CLI Getting Started page) and the plugin for IBM Cloud Databases (ICD) (databases-cli-plugin-cdb-reference). This set of scripts also depends on a command line tool JQ (jq) and information for it can be found here. When you are setting up a Database in IBM cloud you are presented with an op ..read more
Visit website
PostgreSQL Allow listing
PowerShellPosse
by crshnbrn66
1y ago
The purpose of this article is to demonstrate how a function was created to get the current allow listing information for PostgreSQL in IBMCloud. To begin with in order to perform this allow listing on IBM cloud it is assumed that you’ve already installed the IBMCloud Command Line Interface (CLI) (IBM Cloud CLI Getting Started page) and the plugin for IBM Cloud Databases (ICD) (databases-cli-plugin-cdb-reference). This set of scripts also depends on a command line tool JQ (jq) and information for it can be found here. When you are setting up a Database in IBM cloud you are presented with an op ..read more
Visit website
Findit BASH Version
PowerShellPosse
by crshnbrn66
2y ago
In the spirit of short scripts I needed another version of FINDit like you may see in my PowerShell post. Here is that very thing in BASH/ZSH findit() { #$1 is the path to search for a string #$2 is the string to search and find usage() { echo " -- Usage for findit --- \$1 is the path to search for a string \$2 is the string to search and find __________________________ example: findit $HOME/.zshrc powerlevel10k output: /Users/thom.schumacher/.zshrc:10:ZSH_THEME=\"powerlevel10k/powerlevel10k\" /Users/thom.schumacher/.zshrc:50:source ~/pow ..read more
Visit website
Following a URL in a BASH function
PowerShellPosse
by crshnbrn66
2y ago
I had need to ensure a Url was valid.. So i decided to write a function that I could use in my bash session for just that type of thing: followedUrlValid() usage() { echo " -- Usage for followedUrlValid --- \$1 = the account you wish to login to looks for the http_code from getting the url if valid returns true if not returns false if the url has redirects it'll follow the redirects " } if [ -z "$1" ]; then echo >&2 'Need 1 parameters which are not empty' usage return 1 fi returnval='false' value=$(curl -o /dev/null -LIsw '%{http_cod ..read more
Visit website
Parsing path in ZSH
PowerShellPosse
by crshnbrn66
2y ago
Lately i’ve had to work with a new operating system (apple) and it’s built in shell is ZSH. With that i’ve had to understand how to parse strings in it compared to KSH and Bash. One interesting thing I found is that that the standard $PATH variable in zsh is already split into an array for you in this variable $path. So to test and see if something is in your path like BASH you can simply use that variable to your advantage like this: getBashVersion() { for p in $path;do b="$p/bash" if [[ -f "$b" ]]; then echo "_____$(echo $p)______" $b --version | grep version ..read more
Visit website
User & Group information DirectoryServices.AccountManagement
PowerShellPosse
by crshnbrn66
2y ago
When you are tasked with administering windows machines/servers more often than not you need to have Remote Server access tools for the version of Operating system you are supporting.  What do you do when you can’t get those tools installed for administrative or other reasons.  The best thing to do is to look for a means to do this in PowerShell.  This article describes how to find user and group information via the Dll’s that are available on windows. All users/groups and objects in active directory have unique Security Identifier’s. To be able to locate and translate SID’s the ..read more
Visit website
Just Clip it
PowerShellPosse
by crshnbrn66
2y ago
There was a question presented on StackOverflow about how do you pull an image from the Clipboard.  This article is about how this was done with two separate functions. The first function Export-ClipItem is a function that detects what type of item is in the Clipboard.  To perform this function the built in cmdlets with powershell 5.1 work nicely.  This script however, is written assuming that an older version of Powershell maybe required. The first thing that needs to be done is to get a windows form object: Add-Type -AssemblyName System.Windows.Forms $clipboard = [System.Wi ..read more
Visit website
Folder and File
PowerShellPosse
by crshnbrn66
2y ago
After having been in the industry for a while. I must admit that I’ve never tried to create a folder and file with the same name in a folder.    Turns out that there is a rule that the same name can’t exist more than once in a folder or directory.  This applies to both windows and linux systems. I found this out because in my code I didn’t specify the ItemType on New-Item Powershell Cmdlet. new-item $home/.config/j Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 1/4/2019 1:07 PM 0 j new ..read more
Visit website
Finding success with SCCM – trigger Schedule
PowerShellPosse
by crshnbrn66
2y ago
If you’ve ever dealt with SCCM you’ll understand to get a client to forcibly download patches / software from SCCM you’ll need to call WMI to trigger a schedule. The list of triggers can be found here. Trigger schedule This post is about how to find / determine success for one of the triggers in this list: To start with I chose to create a hashTable to hold the triggers with a name: function New-CMSccmTriggerHashTable { $Sccmhash =@{HardwareInventoryCollectionTask='{00000000-0000-0000-0000-000000000001}' SoftwareInventoryCollectionTask='{00000000-0000-0000-0000-0000000000 ..read more
Visit website
(Findit) Locating previously written scripts
PowerShellPosse
by crshnbrn66
2y ago
Another utility Function that I like to use a lot. Especially since I have quite a few scripts is this script that I and a friend worked on together: function findit { param ( [Parameter(Mandatory=$True,Position=0)][string]$SearchString, [Parameter(Mandatory=$False)]$Path = "$env:USERPROFILE\Documents", [Parameter(Mandatory=$False)]$Filter = "*.ps1" ) $launcher = "psedit" if($host.name -eq "ConsoleHost") { $launcher = "notepad"} elseif($Host.name -eq "Visual Studio Code Host") { $launcher = 'code' } $s = Get-ChildItem -Path $Path -Filter $Filter -Recurse | Select ..read more
Visit website

Follow PowerShellPosse on FeedSpot

Continue with Google
Continue with Apple
OR