Skip to content

Instantly share code, notes, and snippets.

SELECT Name, Description FROM fn_helpcollations()
SELECT Name, Description FROM fn_helpcollations() WHERE Name like '%bin2%'
# Run Install-Module -Name SqlServer if module is not present on your system
Import-Module SqlServer
# Set up connection and database SMO objects
$password = "<replace with your password>"
$sqlConnectionString = "Data Source=70-473-sql-server.database.windows.net;Initial Catalog=AZ_DB_TEST_BASIC;User ID=Mikhail;Password=$password;MultipleActiveResultSets=False;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False;Packet Size=4096;Application Name=`"Microsoft SQL Server Management Studio`""
$smoDatabase = Get-SqlDatabase -ConnectionString $sqlConnectionString
# If your encryption changes involve keys in Azure Key Vault, uncomment one of the lines below in order to authenticate:
# * Prompt for a username and password:
REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters\ /v AllowEncryptionOracle /t REG_DWORD /d 2
@mikerodionov
mikerodionov / LoadSpPsModule.ps1
Created June 26, 2018 11:17
Load SharePoint PS Module (if not already loaded)
#Load SharePoint PS Module (if not already loaded)
$ver = $host | select version
if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"}
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
-- Get Process Name by Process Instance ID
USE K2 -- Adjust your K2 DB name if necessarry
DECLARE @PInstID INT
DECLARE @ProcID INT
SET @PInstID=1 -- Specify your Process Instance ID Here
SET @ProcID = (SELECT ProcID FROM Server.ProcInst WHERE ID=@PInstID)
SELECT [Name] FROM Server.[ProcSet] WHERE ID = (SELECT ProcSetID FROM Server.[Proc] WHERE ID=@ProcID)
@mikerodionov
mikerodionov / ADDSCHK.ps1
Last active December 19, 2018 22:22
ADDSCHK
# ADDS Domain quick check
# v.1.0
# Mikhail Rodionov - mikerodionov.com
Function ADDSCHK ()
{
$pc=hostname
$PC_OU=(Get-ADComputer $pc).DistinguishedName
#Get total number of users (enabled and disabled)
$TNU=(Get-ADUser -filter *).count
USE K2
DECLARE @SI_NAME varchar(128)
--Specify you Service Instance Display Name below
SET @SI_NAME='Oracle%'
SELECT ServiceTypeXML
FROM [K2].[SmartBroker].[ServiceType]
WHERE ServiceTypeXML.value('(servicetype/metadata/display/displayname)[1]', 'varchar(max)')
LIKE @SI_NAME;
GO
UPDATE [K2].[SmartBroker].[ServiceType]
SET ServiceTypeXML =
'
<servicetype name="SourceCode.SmartObjects.Services.Oracle.OracleService" guid="c599f60f-7640-4d64-8103-38d60b7c6b61">
<metadata>
<display>
<displayname>Oracle Service</displayname>
<description />
</display>
</metadata>
SELECT *
FROM [K2].[SmartBroker].[ServiceType]
WHERE ServiceTypeXML.value('(servicetype/config/assembly/@path)[1]', 'varchar(max)')
LIKE 'D:\%';
GO