Month: September 2021

PowerShell: Remove A-record in Bluecat

$bluecatUri='https://bluecat.kimconnect.com/Services/API' $bluecatUsername='bluecat-service-api' $bluecatPassword='SOMECOMPLEXPASSWORD' $hostRecord='testrecord.kimconnect.com' function loginBluecat{ param( $username, $password, $uri ) $proxy = New-WebServiceProxy -Uri…

PowerShell: Get SQL Job History

$computername='sql01' function getSqlJobHistory($sqlServerName){ try{ if(!(get-module SqlServer)){ Install-Module -Name SqlServer } Import-Module -Name SqlServer $sqlServerInstance=Get-SqlInstance -ServerInstance…

PowerShell: Get SQL Server Backup Statuses

$computername='sql01' function getSqlBackupInfo ($sqlInstanceName=$env:computername, $dbName){ [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") $location=if($sqlInstanceName.Contains("`\")){ "SQLSERVER:\SQL\$sqlInstanceName\Databases" }else{ "SQLSERVER:\SQL\$sqlInstanceName\DEFAULT\Databases" } function getPacificTime($time){ if($time){ [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($time,'Pacific…

Using SysPrep To Move Windows Users Directory

Assumptions: Windows 2019 Server Standard ISO is mounted as E:\ D:\Users will be the new…

WordPress: Remove ‘Built with Storefront & WooCommerce’ in footer

Credit: @jobthomas Automattic Happiness Engineerhttps://wordpress.org/support/topic/remove-built-with-storefront-footer-link-2/ How to apply: search and install Code Snippets > add…

Use PowerShell to Set Microsoft SQL Database Owner

$owner='CAP\SQL Admins' $databaseName='TestDb' $sqlServer=$env:computername function setDbOwner{ param( $principle=$env:USERDOMAIN+'\Domain Admins', $databaseName='TestDB', $sqlServer ) function includeSqlTools{ $ErrorActionPreference='stop'…

Use PowerShell to Grant SysAdmin Role to Certain Users

$principle=$env:USERDOMAIN+'\Domain Admins' $sqlServer=$env:computername function includeSqlTools{ $ErrorActionPreference='stop' try{ $trustedPsgallery=(Get-PSRepository PSGallery).InstallationPolicy -eq 'Trusted' if(!$trustedPsgallery){ Set-PSRepository -Name PSGallery…

PowerShell: Auto Login to WordPress and Update Gold Prices WooCommerce Plugin

# API URI - these are examples, only $goldPriceApi='https://dragoncoin.com/XAU/USD' $silverPriceApi='https://dragoncoin.com/XAG/USD' $platinumApi='https://dragoncoin.com/XPT/USD' $palladiumApi='https://dragoncoin.com/XPD/USD' # Wordpress WooCommerce…

WordPress: Gold Price Widget CSS

Here's a sample of CSS Code to customize the display of the WordPress' Gold Pricing…

Windows: Disable Automatic Restart After Updates

1. Run gpedit.msc as Administrator2. Navigate to Local Group Policy Editor > Computer Configuration >…

PowerShell: Remove IP Address Assignment Using Bluecat API

$bluecatUri='http://bluecat.kimconnect.com/Services/API' $bluecatUsername='svc-bluecat-api' $bluecatPassword='PASSWORD' $configId=17 $ipv4Address='10.10.162.54' $marker='toBeDeleted-' function confirmation($content,$testValue="I confirm",$maxAttempts=3){ $confirmed=$false; $attempts=0; $content|write-host write-host "Please review…

PowerShell: Unjoin Computer From Domain

# unjoinComputerFromDomain.ps1 # Version 0.02 # Notes: # - This function doesn't delete the referenced…

Windows Server 2019 Remote Desktop Black Screen Problem

While there's no definite solution to this issue, here are some options to work around…

How to Use ImageMagic to Resize Images

Converting PNG to JPG (optimized): # This is an optimized resizing command to convert PNG…

Excel Visual Basic For Application (VBA): Determine IP List

Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True intRow = 2 Set Fso = CreateObject("Scripting.FileSystemObject") Set…

ODBC Driver 32-bit & 64-bit

The 32-bit version: Run: odbcad32.exe > check the list of installed 32-bit drivers as illustrated…

PowerShell: Function to Get Group Members as a Bypass Orphanated SID Errors

Problem: [TESTSERVER]: PS C:\Users\administrator> Get-LocalGroupMember 'Remote Desktop Users' Get-LocalGroupMember : Failed to compare two elements…

CSS: How To Set Color Gradient and Animation to Text and Background

// Static color gradient .colorGradientClass { background-color: #ffffff !important; background-image: linear-gradient(315deg, #ffffff 0%, #d9d9d9 74%)…

Uhhuh. NMI received for unknown reason 3d on CPU 4

Problem: Message from syslogd@linux03 at Aug 31 04:28:21 ... kernel:[273033.123489] Uhhuh. NMI received for unknown…