Skip to content

Instantly share code, notes, and snippets.

View AD_DS_Enable_GC.ps1
Set-ADObject "CN=NTDS Settings,CN=DOMAINCONTROLLER-NAME,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=DOMAIN,DC=COM" -Replace @{options='1'}
View AD_DS_Check_GC_role.ps1
#Open PS session to one of your domain controllers if necessary:
Enter-PSSession -ComputerName cndrm-dc01 -Credential DOMAIN\administrator
#Select IsGlobalCatalog propery for your DCs:
Get-ADDomainController -Filter * | Select-Object -Property Name,IsGlobalCatalog | Format-Table -AutoSize
mikerodionov / Get_SQL_version_and_navigate_to_setup_folder.ps1
Last active Apr 21, 2019
Get installed SQL Server version (for all instances on server) and navigate to the relevant setup folder
View Get_SQL_version_and_navigate_to_setup_folder.ps1
# This scripts detecs installed SQL instances through registry and returns version information
$inst = (get-itemproperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server').InstalledInstances
foreach ($i in $inst)
$p=(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL').$i
(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL').$i
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$p\Setup").Edition
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$p\Setup").Version
$ver = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$p\Setup").Version
switch ($ver) {
View Check table size in Oracle database.sql
SELECT segment_name, segment_type, bytes/1024/1024 MB
FROM user_segments
WHERE segment_type='TABLE' AND segment_name='YOUR_TABLE_NAME'
mikerodionov / Check object owner in Oracle DB.sql
Created Apr 11, 2019
Check object owner in Oracle DB.sql
View Check object owner in Oracle DB.sql
select owner, object_name, object_type
where object_name = 'YOUR_OBJECT_NAME'
View Simplistic_SQL_cycle_example.sql
DECLARE @count int
SET @count = 1
WHILE @count <= 200
INSERT INTO [K2].[dbo].[StringSmO] values ('Subservice To Be Selected in Drop Down Long Name!')
SET @count = @count + 1
View Insert_data_into_FILESTREAM_table.sql
--Example 1- Insert JPG file into FileStream column:
INSERT TestTable(DocumentNumber, DocumentBody)
(1, (SELECT * FROM OPENROWSET (BULK 'C:\Images\Sample_Image.jpg', SINGLE_BLOB) document));
--Example 2 - Convert text into binary format:
INSERT INTO TestTable(DocumentNumber, DocumentBody)
View Start_specified_Number_of_instances.ps1
# Code sample for this can be found in K2 Developer Reference
# 4.7:
# 5.2:
$i = 0
$NumberOfInstancesToStart = 100000
$ProjectName = 'K2Project'
$WorkflowName = 'Process'
View Create_AD_DS_groups.ps1
while($count -ne 10){
New-ADGroup -Path $path -Name $group_name_prefix$count -GroupScope Global -GroupCategory Security
echo "Creating group: " $group_name_prefix$count
View check-sql-instance port.ps1
# You first need to get PID of SQL Server process - sqlservr.exe with this command:
tasklist|find /I "sql"
# It will give you output similar to this one:
# sqlwriter.exe 2168 Services 0 7,804 K
# sqlceip.exe 2768 Services 0 57,876 K
# sqlservr.exe 4620 Services 0 298,496 K
# sqlbrowser.exe 3488 Services 0 4,752 K
# Take a note of PID for sqlservr.exe and use it to check ports which this process is listening
netstat -na | find "4620"
You can’t perform that action at this time.