YokoRUMsetPC.psm1
function Get-Answer { [CmdletBinding()] [OutputType([boolean])] param ( [Parameter(Mandatory = $true)] [string]$message ) $title = "Confirmation" $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 } } 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 Write-Output -InputObject "*`t`t`tDisabling 'Task View' button.`t`t`t`t`t*" } } <# .SYNOPSIS Delete file confrimation .DESCRIPTION Enable Recycle Bin delete confirmation, or disable if enabled with switch -DisableConfirmation .PARAMETER DisableConfirmation Disable delete file confirmation, move to Recycle Bin directly. .EXAMPLE PS C:\> Enable-DeleteConfirmation PS C:\> Enable-DeleteConfirmation -DisableConfirmation .NOTES This changes local machine registry. #> function Enable-DeleteConfirmation { [CmdletBinding()] param ( [switch]$DisableConfirmation ) [int]$value = 1 $state = "enabled" if ($DisableConfirmation) { $value = 0 $state = "disabled" } # $path = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' # Start-Process -FilePath $Powershell -ArgumentList "reg add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' /v 'ConfirmFileDelete' /t REG_DWORD /d '0' /f" -Verb runas -Wait $ProgressPreference = 'SilentlyContinue' $ErrorActionPreference = 'SilentlyContinue' $Powershell = Get-Command -Name 'powershell' -CommandType Application $path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' $name = 'ConfirmFileDelete' if (!(Test-Path -Path $path)) { Start-Process -FilePath $Powershell -ArgumentList "New-Item -Path $path -Force; Set-ItemProperty -Path $path -Name $name -Value $value -Force" -WindowStyle Hidden -Verb runas } else { Start-Process -FilePath $Powershell -ArgumentList "Set-ItemProperty -Path $path -Name $name -Value $value -Force" -WindowStyle Hidden -Verb runas } $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 $value -Force" -WindowStyle Hidden -Verb runas Write-Output -InputObject "*`t`tCreated registry value 'ConfirmFileDelete' and set to $state.`t`t*" } elseif ((Get-ItemProperty -Path $path -Name $name).ConfirmFileDelete -ne 1) { Start-Process -FilePath $Powershell -ArgumentList "Set-ItemProperty -Path $path -Name $name -Value $value -Force; Start-Sleep 20" -WindowStyle Hidden -Verb runas Write-Output -InputObject "*`t`t`t`tDelete confirmation $state.`t`t`t`t*" } } function Get-UrlStatusCode { param ( [Parameter(Mandatory = $true)] [uri]$TestURL ) try { (Microsoft.PowerShell.Utility\Invoke-WebRequest -Uri $TestURL -UseBasicParsing -DisableKeepAlive -ErrorAction SilentlyContinue).StatusCode } catch [Net.WebException] { [int]$_.Exception.Response.StatusCode } } <# .SYNOPSIS Test online access .DESCRIPTION Test if computer can access to www.google.com returns boolean true or false. .EXAMPLE PS C:\> Test-InternetConnection .NOTES Additional information about the function. #> function Test-InternetConnection { [CmdletBinding()] [OutputType([boolean])] param () [uri]$google = 'www.google.com' $WEBtest = Test-Connection -ComputerName $google -Count 2 -ErrorAction SilentlyContinue if ($WEBtest) { return $true } else { return $false } } <# .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.' } 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 -message "Are you sure you want to continue?" } if ($answer) { Set-Clipboard -Value $AdminUsername Write-Output -InputObject "Admin username has been copied to the clipboard." if (!$User) { Get-WindowsAutopilotInfo -GroupTag $Tag -Online } else { Get-WindowsAutopilotInfo -GroupTag $Tag -AssignedUser $User -Online } } else { Write-Output -InputObject "`nAction canceled." } } } <# .SYNOPSIS Enable dotNET 3.5 .DESCRIPTION A detailed description of the Enable-dotNet3.5 function. .EXAMPLE PS C:\> Enable-dotNet3.5 .NOTES Made for Yokohama, Serbia, RUMA. By chixus ©2025. #> function Enable-dotNet3.5 { [CmdletBinding()] param () Write-Output -InputObject "If not enabled, optional feature NexFX3 will be enabled in the 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 Normal -Wait -Verb runas } <# .SYNOPSIS Install Serbian .DESCRIPTION Install Serbian language packs, cyrilic and latin. .EXAMPLE PS C:\> Install-SerbianLanguage .NOTES Installs Serbian latin and cyrilic language. #> 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" -AsJob Write-Output -InputObject "Intalling Serbian latin language pack." Install-Language -Language "sr-Latn-RS" -AsJob } Write-Output -InputObject "Installing Serbian language in background (Cyr and Latn)." # Microsoft.LanguageExperiencePacksr-Cyrl-RS # Microsoft.LanguageExperiencePacksr-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-PublicFolder { [CmdletBinding()] param () $FileExplorer = Get-Command -Name 'Explorer' -CommandType Application $path = '\\twsrumfil001\Public\' if ([System.IO.Directory]::Exists($path)) { Write-Output -InputObject "Opening folder: $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 Install N3 software for Yokohama user via local newtwork or online, no admin right required. .PARAMETER web Install online. .EXAMPLE PS C:\> Install-M3 PS C:\> Install-M3 -online .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) { [boolean]$OnWeb = Test-InternetConnection if (!$OnWeb) { return Write-Error -Message "Check your internet connection." -Category ConnectionError } else { $statusCode = Get-UrlStatusCode -TestURL $site -ErrorAction SilentlyContinue if (($statusCode -eq 0) -or (!$statusCode)) { return Write-Error -Message "Check if you are on YokohamaTWS RUM network or into ZScaler VPN." -Category ConnectionError } } Write-Output -InputObject "Opening webpage to install M3 online from site: $site`nAlso can install from local network at $M3path`n" Start-Process -FilePath msedge -ArgumentList $site -WindowStyle Maximized -Wait } 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 "Executin linkg $InstallFile`nfollow the installation instructions." Start-Process -FilePath $InstallFile -WorkingDirectory $M3path -WindowStyle Hidden -Wait Write-Output -InputObject "Installation process finished. Check if M3 is installed, if not try to use cmdlet:`n'Install-M3 -online' woth online switch." } else { Write-Error -Message "M3 installation shortuct '$InstallFile' does not exist." -Category ObjectNotFound } } else { Write-Warning -Message "Check if you are on YokohamaTWS RUM network or into ZScaler VPN.`n`n" Write-Error -Message "Cannot access network 'public' folder:`n$M3path" -Category ConnectionError } } } } <# .SYNOPSIS Instal printer .DESCRIPTION Install local printer for user. .EXAMPLE PS C:\> Install-Printer .NOTES Opens local network printers shortscuts for installing printer for user. #> function Install-Printer { [CmdletBinding(SupportsShouldProcess = $true)] param () $FileExplorer = Get-Command -Name 'Explorer' -CommandType Application $path = '\\twsrumasl001' if ($pscmdlet.ShouldProcess("Target", "Operation")) { Start-Process -FilePath $FileExplorer -ArgumentList $path -LoadUserProfile } } <# .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 (if Chorme not installed), 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 ) [boolean]$OnWeb = Test-InternetConnection if (!$OnWeb) { return Write-Error -Message "Not connected on internet." -Category ConnectionError } [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 () $ErrorActionPreference = 'SilentlyContinue' $TrayIcons = "HKCU:\Control Panel\NotifyIconSettings" $Property = "IsPromoted" if (Test-Path -LiteralPath $TrayIcons -PathType 'Container') { Get-ChildItem -LiteralPath $TrayIcons | Where-Object { $_.GetValue($Property) -ne 1 } | ForEach-Object { Set-ItemProperty -LiteralPath ($_.PSPath) -Name $Property -Value 1 -Force | Out-Null } -ErrorAction SilentlyContinue } else { Write-Error -Message "Registry path for hidden icons not found." -Category ObjectNotFound } } <# .SYNOPSIS Move taskbar icnos .DESCRIPTION Shift left or to center taskbar icons. .PARAMETER left Move tasbar icons on Windows 11 to the left. .PARAMETER center Return tasbar icons on Windows 11 to the. .EXAMPLE PS C:\> Move-TaskBar PS C:\> Move-TaskBar -left PS C:\> Move-TaskBar -center .NOTES Win11 move taskbat left or center. #> function Move-TaskBar { [CmdletBinding()] param ( [switch]$left, [switch]$center ) $ProgressPreference = 'SilentlyContinue' $ErrorActionPreference = 'SilentlyContinue' if ($left -and $center) { return Write-Error "Nonsense, cannot use botch switches." -Category SyntaxError } $path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" $name = "TaskbarAl" $test = Get-ItemProperty -Path $path -Name $name $centerMSG = "*`t`t`tMoving Taskbar to the center.`t`t`t`t`t*" $leftMSG = "*`t`t`tMoving Taskbar to the left.`t`t`t`t`t*" $WinVer = (Get-ComputerInfo -Property OsName).OsName if ($test) { [int]$value = (Get-ItemProperty -Path $path -Name $name).$name if ($value -eq 1) { $side = 'center.' } elseif ($value -eq 0) { $side = 'left.' } else { Write-Warning -Message "Not expected registry value found - $value." } } if ($WinVer -clike "*11*") { if (!$test -and $left) { New-ItemProperty -Path $path -Name $name -PropertyType DWORD -Value 0 -Force | Out-Null Write-Output -InputObject $leftMSG } elseif (!$test -and $center) { New-ItemProperty -Path $path -Name $name -PropertyType DWORD -Value 1 -Force | Out-Null Write-Output -InputObject $centerMSG } elseif (!$test) { New-ItemProperty -Path $path -Name $name -PropertyType DWORD -Value 0 -Force | Out-Null Write-Output -InputObject $leftMSG } else { if (!$left -and !$center) { if ($value -eq 1) { $value-- Set-ItemProperty -Path $path -Name $name -Value $value -ErrorAction SilentlyContinue -Force | Out-Null Write-Output -InputObject $leftMSG } elseif ($value -eq 0) { $value++ Set-ItemProperty -Path $path -Name $name -Value $value -ErrorAction SilentlyContinue -Force | Out-Null Write-Output -InputObject $centerMSG } else { return Write-Warning "Taskbar registry value unknown, please use switch -left or -center" } } elseif ($left -and $value -ne 0) { Set-ItemProperty -Path $path -Name $name -Value 0 -Force | Out-Null Write-Output -InputObject $leftMSG } elseif ($center -and $value -ne 1) { Set-ItemProperty -Path $path -Name $name -Value 1 -Force | Out-Null Write-Output -InputObject $centerMSG } else { Write-Output -InputObject "*`t`t`t`tTaskbar already on the $side`t`t`t`t*" } } } else { Write-Output -InputObject "*`t`tWindows 11 not detected, Taskbar already on the left....`t`t*" } } function Enable-DesktopIcon { [CmdletBinding()] param () $ErrorActionPreference = 'SilentlyContinue' $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}" $user = $env:USERNAME if ($user.Length -lt 6) { $user = " " + $user $user += " " } if ((Get-ItemProperty -Path $desktopIconSettingsPath -Name $MyComputer).$MyComputer -ne 0) { Write-Output -InputObject "*`t`t`tEnabling 'This PC' (My Computer) icon on Desktop.`t`t*" Set-ItemProperty -Path $desktopIconSettingsPath -Name $MyComputer -Value 0 -Force | Out-Null } if ((Get-ItemProperty -Path $desktopIconSettingsPath -Name $UserFiles).$UserFiles -ne 0) { Write-Output -InputObject "*`t`t`tEnabling '$user' icon on Desktop.`t`t`t`t*" Set-ItemProperty -Path $desktopIconSettingsPath -Name $UserFiles -Value 0 -Force | Out-Null } if ((Get-ItemProperty -Path $desktopIconSettingsPath -Name $Network).$Network -ne 0) { Write-Output -InputObject "*`t`t`tEnabling 'Network' icon on Desktop.`t`t`t`t*" Set-ItemProperty -Path $desktopIconSettingsPath -Name $Network -Value 0 -Force | Out-Null } if ((Get-ItemProperty -Path $desktopSettings -Name $ThemesChange).$ThemesChange -ne 0) { Write-Output -InputObject "*`t`t`tDisabling themes to change icons.`t`t`t`t*" Set-ItemProperty -Path $desktopSettings -Name $ThemesChange -Value 0 -Force | Out-Null } } function Format-RegionalCulture { [CmdletBinding()] param () $ErrorActionPreference = 'SilentlyContinue' $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 | Out-Null Write-Output -InputObject "*`t`tSetting country to:`t`tSerbia`t`t`t`t`t*" } if ((Get-TimeZone).Id -ne $TimeZone) { Set-TimeZone -Id $TimeZone | Out-Null Write-Output -InputObject "*`t`tSetting Time Zone to:`t`t$TimeZone`t`t*" } if ((Get-ItemProperty -Path "HKCU:\Control Panel\International\" -name sShortDate).sShortDate -ne $DateFormat) { Set-ItemProperty -Path "HKCU:\Control Panel\International\" -name sShortDate -value $DateFormat -Force | Out-Null Write-Output -InputObject "*`t`t`tSetting short date format to:`t$DateFormat`t`t`t*" } if ((Get-ItemProperty -Path "HKCU:\Control Panel\International\" -name sLongDate).sLongDate -ne $DateLongFormat) { Set-ItemProperty -Path "HKCU:\Control Panel\International\" -name sLongDate -value $DateLongFormat -Force | Out-Null Write-Output -InputObject "*`t`t`tSetting long date format to:`t$dateLongFormat`t`t*" } if ((Get-ItemProperty -Path "HKCU:\Control Panel\International" -name sShortTime).sShortTime -ne $TimeFormat) { Set-ItemProperty -Path "HKCU:\Control Panel\International" -name sShortTime -value $TimeFormat -Force | Out-Null Write-Output -InputObject "*`t`t`tSetting short time format to:`t$TimeFormat`t`t`t`t*" } if ((Get-ItemProperty -Path "HKCU:\Control Panel\International" -name sTimeFormat).sTimeFormat -ne $TimeLongFormat) { Set-ItemProperty -Path "HKCU:\Control Panel\International" -name sTimeFormat -value $TimeLongFormat -Force | Out-Null Write-Output -InputObject "*`t`t`tSetting long time format to:`t$TimeLongFormat`t`t`t*" } if ((Get-ItemProperty -Path $separator -Name sDecimal).sDecimal -eq ".") { Set-ItemProperty -Path $separator -Name sDecimal -Value "," -Force | Out-Null Set-ItemProperty -Path $separator -Name sThousand -Value "." -Force | Out-Null Write-Output -InputObject "*`t`t`tGroup separator set to:`t`t.`t`t`t`t*`n*`t`t`tDecimal separator set to:`t,`t`t`t`t*" } elseif ((Get-ItemProperty -Path $separator -Name sThousand).sThousand -eq ",") { Set-ItemProperty -Path $eparator -Name sThousand -Value "." -Force | Out-Null Write-Output -InputObject "*`t`t`tGroup separator set to:`t`t.`t`t`t`t*" } } <# .SYNOPSIS Install Total Commander v11.55 .DESCRIPTION Donwload and install Total Commander v11.55 and register it. .PARAMETER DeleteInstallation Removes installation file after install. .EXAMPLE PS C:\> Install-TotalCommander11.55 .NOTES by CHXOFT @2025. #> function Install-TotalCommander11.55 { [CmdletBinding(SupportsShouldProcess = $true)] param ( [switch]$DeleteInstallation ) 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.' } $path = Resolve-Path -Path (Get-Module -Name YokoRUMsetPC -ListAvailable).Path | Split-Path -Parent $setup = "$path\setup.exe" | Resolve-Path $installation = 'tcmd1155x64.exe' if ($setup) { Start-Process -FilePath $setup -WorkingDirectory $path -LoadUserProfile -NoNewWindow -Wait } else { Write-Error -Message "setup.exe not found !" -Category ObjectNotFound } if ($DeleteInstallation) { Remove-Item -Path "$path\$installation" -Force } } <# .SYNOPSIS RESET PRINT SPOOLER AND CLEAR ALL PRINTER QUEUES .DESCRIPTION Reset pritner spooler service on remote computer or on local, if computer name not specified it will be applied to localhost. .PARAMETER ComputerName Computer name on network. .PARAMETER RestartAndClean Reset spooler service, clear queue. .PARAMETER RestartSpoolerService Restart spooler service. .PARAMETER ClearPrintQueue Clear print queue. This will not work if PC is not on DOMAIN network. .EXAMPLE PS C:\> Reset-PrintSpooler PS C:\> Reset-PrintSpooler -ComputerName SERVER03 -RestartSpoolerService .NOTES If no computer name specified, printer spooler service and print queue will be restarted on local PC. #> function Clear-PrinterQueueAndService { [CmdletBinding(SupportsShouldProcess = $true)] param ( [AllowEmptyString()] [string]$ComputerName, [switch]$RestartAndClean, [switch]$RestartSpoolerService, [switch]$ClearPrintQueue ) 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.' } if ($RestartAndClean) { $RestartSpoolerService = $true $ClearPrintQueue = $true } elseif (!$RestartSpoolerService -and !$ClearPrintQueue) { return Write-Warning -Message "No action selected." } if ($ComputerName) { if (Test-Connection -ComputerName $ComputerName -Count 2 -ErrorAction SilentlyContinue) { Write-Output -InputObject "$ComputerName found on network.`n" } else { return Write-Error -Message "$ComputerName not responding." -Category ConnectionError } } if ($RestartSpoolerService) { if (!$ComputerName) { Write-Output -InputObject "Restarting service printer spooler on localhost, $env:COMPUTERNAME" Restart-Service -Name spooler -Force } else { Write-Output -InputObject "Restarting service printer spooler on $ComputerName" Get-Service -Name spooler -ComputerName $ComputerName | Restart-Service -Force } } if ($ClearPrintQueue) { if (!$ComputerName) { Write-Output -InputObject "Stopping service printer spooler on localhost, $env:COMPUTERNAME" Stop-Service -Name spooler Write-Output -InputObject "Deleting print queue." Remove-Item -Path "$env:windir\System32\spool\PRINTERS\*" -Force Write-Output -InputObject "Stopping service printer spooler service." Start-Service -Name spooler } else { Enter-PSSession -ComputerName $ComputerName -ErrorAction Stop Write-Output -InputObject "Stopping service printer spooler on $ComputerName" Stop-Service -Name Spooler -Force Write-Output -InputObject "Deleting print queue from all installed printers." Get-Printer | Get-PrintJob | Remove-PrintJob Write-Output -InputObject "Starting service printer spooler service." Start-Service -Name Spooler Exit-PSSession } } } <# .SYNOPSIS Set PC wit Admin account .DESCRIPTION Set user PC to enable dotNET 3.5, to set time zone automatically, to enable file delete confirmation dialog. All 3 operations at once. .EXAMPLE PS C:\> Set-YokoPC # This cmdlet will call Invoke-AutoTmZndotNETDelConf when needed. .NOTES Do not use this command, it is a part of Set-YokoPC cmdlet. #> function Invoke-AutoTmZndotNETDelConf { [CmdletBinding(SupportsShouldProcess = $false)] param () if (!(New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Error -Message "This function is calling from admin console." -Category PermissionDenied } $ErrorActionPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue' $TZAutoSettingRegPath = 'HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate' $Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' $Name = 'Start' $DelName = 'ConfirmFileDelete' $NexFx3 = 'NetFx3' $DelMSG = "*`t`t`t`tDelete confirmation is enabled.`t`t`t`t*" $state = (Get-WindowsOptionalFeature -FeatureName $NexFx3 -Online).State if ($state -ne 'Enabled') { Write-Output -InputObject "*`t`t`tEnabling optional feature NexFX3 in the background.`t`t`t*" $ProgressPreference = 'Continue' Enable-WindowsOptionalFeature -Online -FeatureName $NexFx3 -All $ProgressPreference = 'SilentlyContinue' } if ((Get-ItemProperty -Path $TZAutoSettingRegPath -Name $Name).$Name -ne 3) { Write-Output -InputObject "*`t`t`t`tSetting Time Zone to automatic.`t`t`t`t*" Set-ItemProperty -Path $TZAutoSettingRegPath -Name $Name -Value 3 -Force | Out-Null } $PathTest = Test-Path -Path $Path if (!$PathTest) { New-Item -Path $Path -Force | Out-Null New-ItemProperty -Path $Path -Name $DelName -Value 1 -Force | Out-Null Write-Output -InputObject "*`t`t`t Delete confirmation registry created.`t`t`t*" Write-Output -InputObject $DelMSG } else { $value = (Get-ItemProperty -Path $Path -Name $DelName).$DelName if ($value -and $value -ne 1) { Set-ItemProperty -Path $Path -Name $DelName -Value 1 -Force | Out-Null Write-Output -InputObject $DelMSG } elseif (!$value) { New-ItemProperty -Path $Path -Name $DelName -Value 1 -Force | Out-Null Write-Output -InputObject $DelMSG } } } <# .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. #> function Set-YokoPC { [CmdletBinding(SupportsShouldProcess = $true)] param () if (!(New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) { $ProgressPreference = 'SilentlyContinue' $ErrorActionPreference = 'SilentlyContinue' [string]$line = "*****************************************************************************************" [string]$lineRow = "*`t`t`t`t`t`t`t`t`t`t`t*" Clear-Host Write-Output -InputObject $line Write-Output -InputObject $lineRow Write-Output -InputObject "*`t`t`t`tSetting Yohohama-tws user PC`t`t`t`t*" Write-Output -InputObject $lineRow Write-Output -InputObject $line Write-Output -InputObject $lineRow if ((Get-Culture).Name -ne "en-US") { Write-Output -InputObject "*`t`t`tSetting region format to: English (United States)`t`t*" Set-Culture -CultureInfo en-US } Move-TaskBar -left Write-Output -InputObject "*`t`t`tShowing hidden tray icons if there is some.`t`t`t*`n$lineRow" Show-TrayIcon Enable-DesktopIcon Disable-TaskView Write-Output -InputObject $lineRow Format-RegionalCulture Write-Output -InputObject $lineRow Write-Output -InputObject "$line" Write-Output -InputObject $lineRow #region AdminSet $outfile = "$env:TEMP\output.txt" $test = Get-Item -Path $outfile $PSexe = Get-Command -Name powershell -CommandType All if ($test) { Remove-Item -Path $outfile -Recurse -Force } $outfile = New-Item -Path "$env:TEMP\output.txt" -ItemType File -Force Start-Process $PSexe -WindowStyle Hidden -Verb RunAs "-Command Invoke-AutoTmZndotNETDelConf | Out-File -FilePath $($outfile.FullName)" -Wait $output = Get-Content -Path $outfile -Force Set-Clipboard -Value $output Remove-Item -Path $outfile -Recurse -Force Write-Output -InputObject $output #endregion Write-Output -InputObject "*`t`t`t Widgets must be disabled manually!`t`t`t`t*" Write-Output -InputObject "*`t`t Please set default apps for Chrome and Acrobat Reader.`t`t*" Write-Output -InputObject $lineRow Write-Output -InputObject "$line`n" Write-Warning -Message "Need to restart PC to changes take the effect..." $answer = Get-Answer -message "Do you want to open default app and recycle bin properties?" if ($answer) { Start-Process -PSPath ms-settings:defaultapps Start-Process shell:recyclebinfolder -Verb properties } } else { Write-Warning -Message "This function must run in not elevated console, as user." } } |