YokoRUMsetPC.psm1

<#
    .SYNOPSIS
        Export HWID for INTUNE
     
    .DESCRIPTION
        Generate HWID with Group Tag to upload to INTUNE or to generate CVS file. REQUIRES ADMIN CONSOLE !
     
    .PARAMETER Tag
        Tag will generate itself for Yokohama, RUMA, if you define it it will be as defined.
     
    .PARAMETER GenerateCSV
        Do not upload online to INTUNE, just make CVS file with Group Tag.
     
    .PARAMETER AssignedUser
        Assign PC to specific user, for exsample: 'user.name@yokohama-tws.com'
     
    .PARAMETER AdminUsername
        Not needed, just fill it to get your admin username on clipboard when uploading online HWID data.
     
    .PARAMETER Force
        Skip confirmation question.
     
    .EXAMPLE
        PS C:\> Export-HWIDtoINTUE
     
    .NOTES
        Made for Yokohama, Serbia, RUMA. By chixus ©2025.
#>

function Export-HWIDtoINTUE
{
    [CmdletBinding()]
    param
    (
        [switch]$GenerateCSV,
        [string]$Tag = 'YTWSEM-RUM',
        [mailaddress]$AssignedUser,
        [string]$AdminUsername,
        [switch]$Force
    )
    
    if (!(New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
    { return Write-Warning -Message 'This function requires admin rights.' }
    
    function Get-Answer
    {
        [CmdletBinding()]
        [OutputType([boolean])]
        param ()
        
        $title = "Confirmation"
        $message = "Are you sure you want to continue?"
        $options = '&Yes', '&No (or any other key)'
        $defaultOption = 1
        $choice = $Host.UI.PromptForChoice($title, $message, $options, $defaultOption)
        if ($choice -eq 0) { return $true }
        else { return $false }
    }
    
    if ($AssignedUser)
    {
        $TextInfo = (Get-Culture).TextInfo
        $UserDisplayName = $AssignedUser.User.Replace('.', ' ')
        $UserDisplayName = $TextInfo.ToTitleCase($UserDisplayName)
        $User = $AssignedUser.Address
    }
    
    [boolean]$answer = $true
    [string]$PCtype = "Unknown"
    $Serial = (Get-CimInstance -class win32_bios).SerialNumber
    Write-Output -InputObject ""
    $FileExplorer = Get-Command -Name 'Explorer' -CommandType Application
    
    if (!(Get-Command -Name Get-WindowsAutopilotInfo -CommandType ExternalScript -ListImported -ErrorAction SilentlyContinue))
    {
        Write-Warning -Message "Get-WindowsAutopilotInfo not installed !"
        Write-Output -InputObject "Installing Get-WindowsAutopilotInfo script"
        Install-Script -Name Get-WindowsAutopilotInfo -Force
    }
    
    # $command = Get-Command -Name Get-WindowsAutopilotInfo -CommandType ExternalScript -ListImported
    
    if ($Tag -ne 'YTWSEM-RUM') { Write-Output -InputObject "Tag defined manually:`t$Tag" }
    else
    {
        if ((Get-CimInstance -Class Win32_ComputerSystem).PCSystemType -eq 2)
        {
            $Tag += "L"
            $PCtype = "Laptop"
        }
        else
        {
            $Tag += "W"
            $PCtype = "Desktop"
        }
        if ($Tag -eq "YTWSEM-RUM") { return Write-Error -Message "Unable to determine PC type to create tag." -Category DeviceError }
    }
    
    if ($GenerateCSV)
    {
        $hashFolder = New-Item -Path "$env:SystemDrive\HWID\" -ItemType Directory -Force
        $Filename = "AutopilotHWID_TAG-$Tag.csv"
        $OutputFile = $hashFolder.FullName + "\$Filename"
        Write-Output -InputObject "Generating hash file`n`nTag:`t`t$Tag`nFilename:`t$Filename`nFolder:`t`t$hashFolder`nPC type:`t$PCtype`nSerial number:`t$Serial"
        Get-WindowsAutopilotInfo -OutputFile $OutputFile -GroupTag $Tag
        Start-Process -FilePath $FileExplorer $hashFolder -WindowStyle Normal -Wait
    }
    else
    {
        if (!$AdminUsername) { $AdminUsername = 'hd.i.benisek@yokohamatws.onmicrosoft.com' }
        Write-Output -InputObject "Admin username:`t`t$AdminUsername"
        Write-Output -InputObject "Computer type:`t`t$PCtype"
        Write-Output -InputObject "$PCtype serial:`t`t$Serial"
        Write-Output -InputObject "Group tag:`t`t$Tag"
        if ($User)
        {
            Write-Output -InputObject "Assigned to user:`t$UserDisplayName"
            Write-Output -InputObject "User login email:`t$User"
        }
        
        if (!$Force)
        {
            Write-Output -InputObject "`nAre you sure you want to upload to INTUNES Autopilot ?"
            $answer = Get-Answer
        }
        
        if ($answer)
        {
            Set-Clipboard -Value $AdminUsername
            Write-Output -InputObject "Admin username has been copied to the clipboard."
            if (!$User) { Get-WindowsAutopilotInfo -GroupTag $Tag -Online -Force }
            else { Get-WindowsAutopilotInfo -GroupTag $Tag -AssignedUser $User -Online -Force }
        }
        else { Write-Output -InputObject "`nAction canceled." }
    }
}

<#
    .SYNOPSIS
        Enable dotNET 3.5
     
    .DESCRIPTION
        A detailed description of the Install-dotNet3.5 function.
     
    .EXAMPLE
        PS C:\> Install-dotNet3.5
     
    .NOTES
        Made for Yokohama, Serbia, RUMA. By chixus ©2025.
#>

function Enable-dotNet3.5
{
    [CmdletBinding()]
    param ()
    
    Write-Output -InputObject "If not enabled, enabling optional feature NexFX3 in background."
    $Powershell = Get-Command -Name 'powershell' -CommandType Application
    $Arguments = "if (((Get-WindowsOptionalFeature -FeatureName NetFx3 -Online).State) -ne 'Enabled') { Enable-WindowsOptionalFeature -Online -FeatureName NetFx3 -All }"
    Start-Process -FilePath $Powershell -ArgumentList $Arguments -WindowStyle Hidden -Verb runas
}

<#
    .SYNOPSIS
        Install Serbian
     
    .DESCRIPTION
        Install Serbian language packs, cyrilic and latin.
     
    .EXAMPLE
                PS C:\> Install-SerbianLanguage
     
    .NOTES
        Additional information about the function.
#>

function Install-SerbianLanguage
{
    [CmdletBinding(SupportsShouldProcess = $true)]
    param ()
    
    $admin = [boolean]([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
    if (!$admin) { return Write-Error -Message "Must run in Admin console." -Category AuthenticationError }
    
    if ($pscmdlet.ShouldProcess("Target", "Operation"))
    {
        Write-Output -InputObject "Intalling Serbian cyrilic language pack."
        Install-Language -Language "sr-Cyrl-RS"
        Write-Output -InputObject "Intalling Serbian latin language pack."
        Install-Language -Language "sr-Latn-RS"
    }
}

<#
    .SYNOPSIS
        Opens P:\IT\Programi\
     
    .DESCRIPTION
        Open public network shared folder with programs installations.
     
    .EXAMPLE
        PS C:\> Open-PublicITfolder
     
    .NOTES
        Made for Yokohama, Serbia, RUMA. By chixus ©2025.
#>

function Open-PublicITfolder
{
    [CmdletBinding()]
    param ()
    
    $FileExplorer = Get-Command -Name 'Explorer' -CommandType Application
    $path = '\\twsrumfil001\Public\IT\programi'
    if ([System.IO.Directory]::Exists($path)) { Start-Process -FilePath $FileExplorer -ArgumentList $path -WindowStyle Normal -Wait }
    else { Write-Error -Message "Cannot access shared public folder." -Category ConnectionError }
}

<#
    .SYNOPSIS
        Imstall M3 for user
     
    .DESCRIPTION
        A detailed description of the Install-M3 function.
     
    .PARAMETER web
        Install online.
     
    .EXAMPLE
        PS C:\> Install-M3
     
    .NOTES
        Install M3 for user.
#>

function Install-M3
{
    [CmdletBinding(SupportsShouldProcess = $true)]
    param
    (
        [switch]$online
    )
    
    [uri]$site = 'https://Twsm3isoprd.yokohama-tws.com:20108/mango'
    $M3path = '\\twsrumfil001\Public\IT\programi\M3'
    $InstallFile = 'M3 install.lnk'
    
    if ($pscmdlet.ShouldProcess("Target", "Operation"))
    {
        if ($online)
        {
            Write-Output -InputObject "Opening webpage to install M3 online from site: $site`nAlso can install from local network at 'P:\IT\Programi\M3'`n"
            Start-Process -FilePath msedge -ArgumentList $site -WindowStyle Maximized
        }
        else
        {
            if (([System.IO.Directory]::Exists($M3path)))
            {
                Write-Output -InputObject "Opening installation folder: $M3path"
                $FileExplorer = Get-Command -Name 'Explorer' -CommandType Application
                Start-Process -FilePath $FileExplorer -ArgumentList $M3path -WindowStyle Normal -Wait
                if (Test-Path -Path "$M3path\$InstallFile" -PathType Leaf)
                {
                    Write-Output -InputObject "Follow install instruction."
                    Start-Process -FilePath $InstallFile -WorkingDirectory $M3path -WindowStyle Hidden -Wait
                    Write-Output -InputObject "Installation complete."
                }
                else { Write-Error -Message "M3 installation shortuct does not exist." -Category ObjectNotFound }
            }
            else
            {
                Write-Error -Message "Cannot access public folder." -Category ConnectionError
                Write-Output -InputObject "Try to use online installation with cmdlet:`n`nInstall-M3 -online`n"
            }
        }
    }
}

<#
    .SYNOPSIS
        Instal printer
     
    .DESCRIPTION
        Install local printer for user.
     
    .EXAMPLE
                PS C:\> Install-Printer
     
    .NOTES
        Additional information about the function.
#>

function Install-Printer
{
    [CmdletBinding(SupportsShouldProcess = $true)]
    param ()
    
    if ($pscmdlet.ShouldProcess("Target", "Operation"))
    {
        $FileExplorer = Get-Command -Name 'Explorer' -CommandType Application
        $path = '\\twsrumasl001'
        if ([System.IO.Directory]::Exists($path)) { Start-Process -FilePath $FileExplorer -ArgumentList $path -LoadUserProfile }
        else
        { Write-Error -Message "Cannot access printer network folder." -Category ConnectionError }
    }
}

<#
    .SYNOPSIS
        Set 2 factor authorisation
     
    .DESCRIPTION
        Set multi factor authorisation to Microsoft authenticator.
     
    .PARAMETER incognito
        Open Chrome in incognito (private) mode.
     
    .PARAMETER anybrowser
        Open from any installed browser, does not apply incognito option.
     
    .EXAMPLE
        PS C:\> Set-MFA
        PS C:\> Set-MFA -incognito
     
    .NOTES
        Made for Yokohama, Serbia, RUMA. By chixus ©2025.
#>

function Set-MFA
{
    [CmdletBinding(SupportsShouldProcess = $true)]
    param
    (
        [switch]$incognito,
        [switch]$anybrowser
    )
    
    [uri]$site = 'https://aka.ms/mfasetup'
    $Arguments = $site
    
    if ($incognito) { $Arguments = $Arguments + " --incognito" }
    
    if ($pscmdlet.ShouldProcess("Target", "Operation"))
    {
        if ($anybrowser)
        {
            Write-Output -InputObject "This option does not inculde incognito option, opening`n$site`n"
            Start-Process -FilePath $site -WindowStyle Maximized
        }
        else
        {
            Start-Process -FilePath chrome -ArgumentList $Arguments -ErrorAction SilentlyContinue
            $testChrome = Get-Process -Name chrome -ErrorAction SilentlyContinue
            if ($testChrome) { Write-Output -InputObject "Visiting: $site to set multi factor authorisation." }
            else
            {
                Write-Error -Message "Google Chrome browser not installed." -Category NotInstalled
                Write-Output -InputObject "Try cmdlet with this switch:`n`nSet-MFA -anybroser`n"
            }
        }
    }
}

function Show-TrayIcon
{
    [CmdletBinding()]
    param ()
    
    $TrayIcons = "HKCU:\Control Panel\NotifyIconSettings"
    $Property = "IsPromoted"
    if (Test-Path -LiteralPath $TrayIcons -PathType 'Container' -ErrorAction SilentlyContinue)
    {
        Get-ChildItem -LiteralPath $TrayIcons |
        Where-Object { $_.GetValue($Property) -ne 1 } |
        ForEach-Object {
            Set-ItemProperty -LiteralPath ($_.PSPath) -Name $Property -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null
        }
    }
    else { Write-Error -Message "Registry path for hidden icons not found." -Category ObjectNotFound }
}

function Move-TaskBarLeft
{
    [CmdletBinding()]
    param ()
    
    $path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
    $name = "TaskbarAl"
    $test = Get-ItemProperty -Path $path -Name $name -ErrorAction SilentlyContinue
    if (!$test) { New-ItemProperty -Path $path -Name $name -PropertyType DWORD -Value 0 -Force | Out-Null }
}

function Enable-DesktopIcon
{
    [CmdletBinding()]
    param ()
    
    $desktopIconSettingsPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"
    $desktopSettings = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes"
    $ThemesChange = "ThemeChangesDesktopIcons"
    $MyComputer = "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
    $UserFiles = "{59031a47-3f72-44a7-89c5-5595fe6b30ee}"
    $Network = "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"
    Set-ItemProperty -Path $desktopIconSettingsPath -Name $MyComputer -Value 0 -Force | Out-Null
    Set-ItemProperty -Path $desktopIconSettingsPath -Name $UserFiles -Value 0 -Force | Out-Null
    Set-ItemProperty -Path $desktopIconSettingsPath -Name $Network -Value 0 -Force | Out-Null
    Set-ItemProperty -Path $desktopSettings -Name $ThemesChange -Value 0 -Force | Out-Null
}

function Disable-TaskView
{
    [CmdletBinding()]
    param ()
    
    $path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
    $name = "ShowTaskViewButton"
    $value = Get-ItemProperty -Path $path -Name $name -ErrorAction SilentlyContinue
    if ($value.ShowTaskViewButton -ne 0) { Set-ItemProperty -Path $path -Name $name -Value 0 -Force }
}

function Format-RegionalCulture
{
    [CmdletBinding()]
    param ()
    
    $DateFormat = 'dd.MM.yyyy'
    $DateLongFormat = 'dddd, MMMM d, yyyy'
    $TimeZone = 'Central Europe Standard Time'
    $TimeFormat = 'HH:mm'
    $TimeLongFormat = 'HH:mm:ss'
    $separator = "HKCU:\Control Panel\International"
    
    if ((Get-WinHomeLocation).GeoId -ne 271)
    {
        Set-WinHomeLocation -GeoId 271
        Write-Output -InputObject "Setting country to:`t`tSerbia"
    }
    if ((Get-TimeZone).Id -ne $TimeZone)
    {
        Set-TimeZone -Id $TimeZone
        Write-Output -InputObject "Setting Time Zone to:`t`t$TimeZone"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International\" -name sShortDate).sShortDate -ne $DateFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International\" -name sShortDate -value $DateFormat
        Write-Output -InputObject "Setting short date format to:`t$DateFormat"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International\" -name sLongDate).sLongDate -ne $DateLongFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International\" -name sLongDate -value $DateLongFormat
        Write-Output -InputObject "Setting long date format to:`t$dateLongFormat"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International" -name sShortTime).sShortTime -ne $TimeFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International" -name sShortTime -value $TimeFormat
        Write-Output -InputObject "Setting short time format to:`t$TimeFormat"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International" -name sTimeFormat).sTimeFormat -ne $TimeLongFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International" -name sTimeFormat -value $TimeLongFormat
        Write-Output -InputObject "Setting long time format to:`t$TimeLongFormat"
    }
    if ((Get-ItemProperty -Path $separator -Name sDecimal).sDecimal -eq ".")
    {
        Set-ItemProperty -Path $separator -Name sDecimal -Value ","
        Set-ItemProperty -Path $separator -Name sThousand -Value "."
        Write-Output -InputObject "Group separator set to:`t`t.`nDecimal separator set to:`t,"
    }
    elseif ((Get-ItemProperty -Path $separator -Name sThousand).sThousand -eq ",")
    {
        Set-ItemProperty -Path $eparator -Name sThousand -Value "."
        Write-Output -InputObject "Group separator set to:`t`t."
    }
}

function Enable-DeleteConfirmation
{
    [CmdletBinding()]
    param ()
    
    $Powershell = Get-Command -Name 'powershell' -CommandType Application
    $path = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'
    $name = 'ConfirmFileDelete'
    if (!(Test-Path -Path $path))
    {
        Start-Process -FilePath $Powershell -ArgumentList "New-Item -Path $path -Force | Out-Null; Set-ItemProperty -Path $path -Name $name -Value 1 -Force" -WindowStyle Hidden -Verb runas -Wait
        
        Start-Process -FilePath $Powershell -ArgumentList "New-Item -Path $path -Force; Set-ItemProperty -Path $path -Name $name -Value 1 -Force" -WindowStyle Hidden -Verb runas -Wait
    }
    else
    {
        Start-Process -FilePath $Powershell -ArgumentList "Set-ItemProperty -Path $path -Name $name -Value 1 -Force" -WindowStyle Hidden -Verb runas -Wait
    }
    
    $RegCheck = Get-Item -Path $path -ErrorAction SilentlyContinue
    if (!$RegCheck)
    {
        Start-Process -FilePath $Powershell -ArgumentList "New-Item -Path $path -Force; New-ItemProperty -Path $path -Name $name -PropertyType DWORD -Value 1 -Force" -WindowStyle Hidden -Verb runas -Wait
        Write-Output -InputObject "Created value ConfirmFileDelete and set to enabled."
    }
    elseif ((Get-ItemProperty -Path $path -Name $name).ConfirmFileDelete -ne 1)
    {
        Start-Process -FilePath $Powershell -ArgumentList "Set-ItemProperty -Path $path -Name $name -Value 1 -Force" -WindowStyle Hidden -Verb runas -Wait
        Write-Output -InputObject "Delete confirmation enabled."
    }
    
}

function Set-AutoTImeZone
{
    [CmdletBinding(SupportsShouldProcess = $true)]
    param ()
    
    $TZAutoSettingRegPath = 'HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate'
    $name = 'Start'
    
    if ($pscmdlet.ShouldProcess("Target", "Operation"))
    {
        if ((Get-ItemProperty -Path $TZAutoSettingRegPath -Name $name).Start -ne 3) { Start-Process -FilePath powershell -ArgumentList "Set-ItemProperty -Path $TZAutoSettingRegPath -Name $name -Value 3 -Force" -WindowStyle Hidden -Verb runas }
    }
}

<#
    .SYNOPSIS
        Set user PC
     
    .DESCRIPTION
        Private cmdlet for setting Yokohama - Serbia - Ruma user PC.
     
    .EXAMPLE
        PS C:\> Set-YokoPC
     
    .NOTES
        Private cmdlet, no additional info.
     
    .PARAMETER
        A description of the parameter.
     
    .PARAMETER
        A description of the parameter.
     
    .PARAMETER
        Specify user to apply settings.
     
    .PARAMETER
        Apply setting to all users on PC.
#>

function Set-YokoPC
{
    [CmdletBinding(SupportsShouldProcess = $true)]
    param ()
    
    $ProgressPreference = 'SilentlyContinue'
    [string]$line = "-----------------------------------------------------------------------------"
    
    Write-Output -InputObject $line
    Write-Output -InputObject "If not installed, dotNET 3.5 will install in the background."
    Install-dotNet3.5
    if ((Get-Culture).Name -ne "en-US")
    {
        Write-Output -InputObject "Setting region format to:`tEnglish (United States)"
        Set-Culture -CultureInfo en-US
    }
    if ((Get-ComputerInfo -Property OsName).OsName -clike "*11*")
    {
        Write-Output -InputObject "Moving Taskbar to the left."
        Move-TaskBarLeft
    }
    else
    { Write-Output -InputObject "Windows 11 not detected, Taskbar already on the left." }
    Show-TrayIcon
    Write-Output -InputObject "Showing hidden tray icons if there is some."
    Enable-DesktopIcon
    $user = $env:USERNAME
    Write-Output -InputObject "Enabling icons on Desktop: 'This PC' (My Computer), '$user' and 'Network'."
    Disable-TaskView
    Write-Output -InputObject "Disabling 'Task View' button."
    Format-RegionalCulture
    Write-Output -InputObject $line
    Write-Warning -Message 'Next two settings will require Admin prvileges.'
    Write-Output -InputObject $line
    Start-Sleep -Seconds 3
    Write-Output -InputObject 'Enabling Recycle Bin delete confirmation dialog.'
    Enable-DeleteConfirmation
    Write-Output -InputObject 'Setting Time Zone to automatic.'
    Set-AutoTImeZone
    Write-Output -InputObject $line
    Write-Output -InputObject "Widgets must be disabled manually."
    Write-Output -InputObject 'Set default apps.'
    Start-Sleep -Seconds 3
    Start-Process -PSPath ms-settings:defaultapps
    Write-Warning -Message "`nNeed to restart PC to changes take the effect.`n"
}

<#
    .SYNOPSIS
        Set PC alternative cmdlet
     
    .DESCRIPTION
        A detailed description of the Set-AllInOne function.
     
    .EXAMPLE
        PS C:\> Set-AllInOne
     
    .OUTPUTS
        boolean
     
    .NOTES
        Made for Yokohama, Serbia, RUMA. By chixus ©2025.
#>

function Set-AllInOne
{
    [CmdletBinding(DefaultParameterSetName = 'Win11',
                   SupportsShouldProcess = $true)]
    [OutputType([boolean], ParameterSetName = 'Win11')]
    param ()
    
    $ProgressPreference = 'SilentlyContinue'
    $DateFormat = 'dd.MM.yyyy'
    $DateLongFormat = 'dddd, MMMM d, yyyy'
    $TimeZoneAuto = 'On'
    $TimeZone = 'Central Europe Standard Time'
    $TimeFormat = 'HH:mm'
    $TimeLongFormat = 'HH:mm:ss'
    $TZAutoSettingRegPath = "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate"
    $separator = "HKCU:\Control Panel\International"
    $desktopIconSettingsPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"
    $desktopSettings = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes"
    $ThemesChange = "ThemeChangesDesktopIcons"
    $MyComputer = "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
    $UserFiles = "{59031a47-3f72-44a7-89c5-5595fe6b30ee}"
    $Network = "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"
    $TrayIcons = "HKCU:\Control Panel\NotifyIconSettings"
    $Property = "IsPromoted"
    [string]$line = "*****************************************************************************************"
    [string]$lineRow = "*`t`t`t`t`t`t`t`t`t`t`t*"
    Clear-Host; Write-Output -InputObject $line; Write-Output -InputObject "*`t`t`t`tUpdating user's settings`t`t`t`t*"; Write-Output -InputObject $line; Write-Output -InputObject $lineRow
    
    if ((Get-ComputerInfo -Property OsName).OsName -clike "*11*") { $Win11 = $true }
    else { $Win11 = $false }
    if ((Get-Culture).Name -ne "en-US")
    {
        Set-Culture -CultureInfo "en-US"
        Write-Output -InputObject "Setting region format to:`tEnglish (United States)"
    }
    if ((Get-WinHomeLocation).GeoId -ne 271)
    {
        Set-WinHomeLocation -GeoId 271
        Write-Output -InputObject "Setting country to:`t`t`tSerbia"
    }
    if ((Get-TimeZone).Id -ne $TimeZone)
    {
        Set-TimeZone -Id $TimeZone
        Write-Output -InputObject "Setting Time Zone to:`t`t$TimeZone"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International\" -name sShortDate).sShortDate -ne $DateFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International\" -name sShortDate -value $DateFormat
        Write-Output -InputObject "Setting short date format to:`t$DateFormat"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International\" -name sLongDate).sLongDate -ne $DateLongFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International\" -name sLongDate -value $DateLongFormat
        Write-Output -InputObject "Setting long date format to:`t$dateLongFormat"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International" -name sShortTime).sShortTime -ne $TimeFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International" -name sShortTime -value $TimeFormat
        Write-Output -InputObject "Setting short time format to:`t$TimeFormat"
    }
    if ((Get-ItemProperty -Path "HKCU:\Control Panel\International" -name sTimeFormat).sTimeFormat -ne $TimeLongFormat)
    {
        Set-ItemProperty -Path "HKCU:\Control Panel\International" -name sTimeFormat -value $TimeLongFormat
        Write-Output -InputObject "Setting long time format to:`t`t$TimeLongFormat"
    }
    if ((Get-ItemProperty -Path $separator -Name sDecimal).sDecimal -eq ".")
    {
        Set-ItemProperty -Path $separator -Name sDecimal -Value ","
        Set-ItemProperty -Path $separator -Name sThousand -Value "."
        Write-Output -InputObject "Group separator set to:`t`t.`nDecimal separator set to:`t`t,"
    }
    elseif ((Get-ItemProperty -Path $separator -Name sThousand).sThousand -eq ",")
    {
        Set-ItemProperty -Path $eparator -Name sThousand -Value "."
        Write-Output -InputObject "Group separator set to:`t`t."
    }
    Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name ShowTaskViewButton -Value 0 -Force | Out-Null
    Write-Output -InputObject "Task view disabled."
    Set-ItemProperty -Path $desktopIconSettingsPath -Name $MyComputer -Value 0 -Force | Out-Null
    Set-ItemProperty -Path $desktopIconSettingsPath -Name $UserFiles -Value 0 -Force | Out-Null
    Set-ItemProperty -Path $desktopIconSettingsPath -Name $Network -Value 0 -Force | Out-Null
    Set-ItemProperty -Path $desktopSettings -Name $ThemesChange -Value 0 -Force | Out-Null
    Write-Output -InputObject "Showing My Computer, User's files and Network on Desktop."
    if ($Win11)
    {
        Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarAl -Value 0
        Write-Output -InputObject "Taskbar moved to the left."
    }
    if (Test-Path -LiteralPath $TrayIcons -PathType 'Container' -ErrorAction SilentlyContinue)
    {
        Get-ChildItem -LiteralPath $TrayIcons |
        Where-Object { $_.GetValue($Property) -ne 1 } |
        ForEach-Object {
            Set-ItemProperty -LiteralPath ($_.PSPath) -Name $Property -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null
        }
        Write-Output -InputObject "Tray icons unhided (if there was hidden)."
    }
    else { Write-Output -InputObject "Registry path not found !!!" }
    # admin needed.
    if ((Get-ItemProperty -Path $TZAutoSettingRegPath -Name 'Start').Start -ne 3)
    {
        Start-Process -FilePath powershell -ArgumentList "Set-ItemProperty -Path $TZAutoSettingRegPath -Name 'Start' -Value 3 -Force" -WindowStyle Hidden -Verb runas
        Write-Output -InputObject "Set time zone automatically:`t$TimeZoneAuto"
    }

    $RegCheck = Get-Item -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -ErrorAction SilentlyContinue
    if (!$RegCheck)
    {
        Start-Process -FilePath powershell -ArgumentList "New-Item -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force; New-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'ConfirmFileDelete' -PropertyType DWORD -Value 1 -Force" -WindowStyle Hidden -Verb runas
        Write-Output -InputObject "Created value ConfirmFileDelete and set to enabled."
    }
    elseif ((Get-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'ConfirmFileDelete').ConfirmFileDelete -ne 1)
    {
        Start-Process -FilePath powershell -ArgumentList "Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'ConfirmFileDelete' -Value 1 -Force" -WindowStyle Hidden -Verb runas
        Write-Output -InputObject "Delete confirmation enabled."
    }

    Write-Output -InputObject "Widgets must be disabled manually."
    Write-Output -InputObject "Setup finished, need to restart the computer."
}