View Get-ADCluster.ps1
Get-ADComputer -Filter { servicePrincipalName -like "MSServerCluster*"} | Select-Object DNSHostName |
View Sync-TfsIdentity.ps1
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true, Position=0)] | |
[uri] | |
$ServerUri | |
) | |
$ErrorActionPreference = 'Stop' | |
Set-StrictMode -Version Latest |
View TFSIdentSyncHistory.sql
SELECT | |
[QueueTime], | |
[StartTime], | |
[EndTime], | |
[Result], | |
[QueuedReasons] = CASE jobHist.[QueuedReasons] | |
WHEN 1 THEN N'Scheduled' | |
WHEN 2 THEN N'Manual' | |
ELSE 'Unknown' | |
END, |
View ClearKerberosComputerTicketsAndCertutilCache.ps1
# Clear Computer Kerberos tickets | |
klist -li 0x3e7 purge | Out-Null | |
# Clear certutil cache | |
certutil -f -policyserver * -policycache delete | Out-Null |
View TempDisableADSyncExportDeletionThreshold.ps1
Import-Module ADSync | |
# Your AAD Credentials | |
$Credential = Get-Credential | |
# Disable the deletion threshold | |
Disable-ADSyncExportDeletionThreshold -AADCredential $Credential | |
# Sync changes | |
Start-ADSyncSyncCycle -PolicyType Delta | |
# Enable deletion threshold with default value of 500 | |
Enable-ADSyncExportDeletionThreshold -AADCredential $Credential -DeletionThreshold 500 |
View ConvertFrom-Xml.ps1
function ConvertFrom-Xml { | |
<# | |
.SYNOPSIS | |
Converts XML object to PSObject representation for further ConvertTo-Json transformation | |
.EXAMPLE | |
# JSON->XML | |
$xml = ConvertTo-Xml (get-content 1.json | ConvertFrom-Json) -Depth 4 -NoTypeInformation -as String | |
.EXAMPLE | |
# XML->JSON | |
ConvertFrom-Xml ([xml]($xml)).Objects.Object | ConvertTo-Json |
View Get-MyAzureRmAutomationHybridWorkerGroup.ps1
$ComputerSystem = (Get-CimInstance Win32_ComputerSystem) | |
$FqDn = "$($ComputerSystem.Name).$($ComputerSystem.Domain)" | |
$HybridWorkerGroup = Get-AzureRmAutomationAccount | Get-AzureRMAutomationHybridWorkerGroup | Where-Object { $FqDn -in $_.RunbookWorker.Name } | |
$HybridWorkerGroup.RunbookWorker.Name |
View InviteAzureUser.ps1
# Use Azure AD Username | |
$User = "AzureUsername" | |
$TargetTenant = "TargetTenant" | |
# Login | |
$Cred = Get-Credential | |
Connect-AzureAD -Credential $cred | |
# Generate Invitation, but do not send | |
$Invitation = New-AzureADMSInvitation -InvitedUserEmailAddress $User -InvitedUserDisplayName $User -InviteRedirectUrl "https://portal.azure.com/$($TargetTenant)" -SendInvitationMessage $false | |
# Copy redeem URL to clipboard | |
$Invitation | Select-Object –ExpandProperty InviteRedeemUrl | clip |
View gist:fbfb731cc9b6b22119fe6cfdcdcf88ca
USE [DATENBANK] | |
SELECT | |
[UserName] = CASE princ.[type] | |
WHEN 'S' THEN princ.[name] | |
WHEN 'U' THEN ulogin.[name] COLLATE Latin1_General_CI_AI | |
END, | |
[UserType] = CASE princ.[type] | |
WHEN 'S' THEN 'SQL User' | |
WHEN 'U' THEN 'Windows User' | |
END, |
View Enable-OpenSSHServer.ps1
# OpenSSH Server installieren | |
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 | |
# Dienst starten | |
Start-Service sshd | |
# Starttyp auf "Automatisch" stellen | |
Set-Service sshd -StartupType Automatic | |
Set-Service ssh-agent -StartupType Automatic |
OlderNewer