Example how to split text into 2 part with Powershell version 2+.
Example 1:
#Simple text split based on delimiter
$text = "Left Part;Right Part"
$pos = $text.IndexOf(";")
$leftPart = $text.Substring(0, $pos)
$rightPart = $text.Substring($pos+1)
Write-Output $leftPart
Write-Output $rightPart
Example 2:
Article describing registration of Active Directory Service Principal Names (SPN) and troubleshooting.
Registration of SPN’s have 2 most common used variants:
Fast tutorial how to install into ISPConfig 3.1 Additional PHP Versions without compiling from sources.
Note: There is official tutorial on howtoforge.com but from my point of view is so complicated and each time you need to compile new PHP version or additional PHP extensions. That’s the reason why repository is the best choice and super easy to setup in this tutorial instead of compiling PHP from sources.
This article contains Powershell script which will backup Active Directory Group Policy Objects.
#-----User variables to modify-----#
$Path = "C:\Backups\GPO-Backup" #Destination backup folder
$Days = "30" #How many days to keep in backup $Path folder
#----------------------------------#
#--Execution code (do not touch)---#
$ActualDate = (Get-Date -Format d.M.yyyy__H_mm_s) #Actual date for folder creation
$sw = [system.diagnostics.stopwatch]::startNew()
If ((Test-Path -Path $Path)) {
If (Get-Module -ListAvailable -Name GroupPolicy) {
$sw.Start()
Import-Module GroupPolicy -ErrorAction Stop
New-Item -Path "$Path\$ActualDate" -ItemType directory
Start-Transcript -Path "$Path\$ActualDate\TranscriptLog.txt" #To Keep GpoId and Id history to better identify GPOs
Backup-GPO -All -Path "$Path\$ActualDate"
$DeleteFolders = (Get-ChildItem -Path $Path | Where-Object PSIsContainer -eq "True" | Where-Object CreationTime -le (Get-Date).AddDays(-$Days) ) | Remove-Item -Force -Recurse
$sw.Stop()
Write-Output "Finished! Removed backup GPO folders based on '$Days' days retention period. Elapsed time: $($sw.Elapsed.Seconds) seconds."
Stop-Transcript
}#EndIf
Else {
Write-Warning "Script stopped! GroupPolicy module is not installed on this machine!"
}#EndElse
}#EndIf
Else {
Write-Warning "Script stopped! Provided path '$Path' does not exist!"
}#EndElse
#----------------------------------#
Tip how to schedule with Tasks Scheduler Powershell script which contains function we need to run and parameters.
Scenario:
Our scheduled task will contain in tab Actions following action:
Express guide how to export private key from certificate storage marked during import as non-exportable.
cd C:\Users\Administrator\Downloads\mimikatz_trunk\x64
.\mimikatz.exe
``` ```
mimikatz # crypto::capi
mimikatz # crypto::certificates /systemstore=CERT_SYSTEM_STORE_LOCAL_MACHINE /export
mimikatz # quit
How to fix problem in the “DCOM: Machine Access Restrictions” and “DCOM: Machine Launch Restrictions”.
If you see pool of errors with DCOM 10024 in System log then proceed with followng steps to fix this:
There is Microsoft article which explains why to do not redirect user profiles/home folders to non-system disk: LINK.
By changing the default location of the user profile directories or program data folders to a volume other than the System volume, you will not be able to service your Windows installation. Any updates, fixes, or service packs will fail to be applied to the installation. Microsoft does not recommend that you change the location of the user profile directories or program data folders.
How to make one static DNS record for single domain with subdomains on MikroTik 6.37.X:
/ip dns static
add address=192.168.1.243 regexp=.*example1.com
add address=192.168.1.245 regexp=.*example2.com
These comments were imported from the original WordPress post.