Avatar

Links

michael-sabrnak-swi (corporate)
MyKEms (personal)
@rss
  • 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:

    Created Wed, 13 Dec 2017 14:36:57 +0000
  • Article describing registration of Active Directory Service Principal Names (SPN) and troubleshooting.

    Registration of SPN’s have 2 most common used variants:

    Created Wed, 30 Aug 2017 11:20:14 +0000
  • 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.

    Created Sat, 12 Aug 2017 09:40:59 +0000
  • 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
    #----------------------------------#
    
    Created Thu, 06 Jul 2017 17:00:25 +0000
  • Tip how to schedule with Tasks Scheduler Powershell script which contains function we need to run and parameters.

    Scenario:

    • We have Powershell script called MyFunctions.ps1 saved in C:\Scripts
    • We want to run function called Get-MyFiles
    • We have 2 mandatory parameters: Path, TranscriptPath
    • We use 1 global parameter: Verbose

    Our scheduled task will contain in tab Actions following action:

    Created Thu, 06 Jul 2017 16:51:52 +0000
  • 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
    
    • You can find exported certificate with private key inside mimikatz folder.
    • Password for import of the certificate: mimikatz
    Created Mon, 03 Jul 2017 11:39:31 +0000
  • Guide how to access VSS Shadow Copies / Previous Versions / Windows Backups.

    1. Standard way – GUI

    • Windows Server Backup (wbadmin.msc)
    • Previous Versions

    2. Symbolic link

    Created Fri, 30 Jun 2017 13:44:49 +0000
  • 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:

    Created Sun, 04 Jun 2017 12:31:48 +0000
  • 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.

    Created Tue, 14 Mar 2017 13:16:19 +0000
  • 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
    

    Historical Comments

    These comments were imported from the original WordPress post.

    Created Sun, 29 Jan 2017 21:46:08 +0000