tom42tools.psm1
function DeployMe() { <# .SYNOPSIS Downloads .ps1 and runs it as admin .DESCRIPTION Used for system reinstalls, it downloads .ps1 and runs it as admin, it will also record restore folder Downloads .ps1 and runs it as admin .PARAMETER URL URL to a .ps1 files .PARAMETER Restorefolder Where the old install backup files were movied to .EXAMPLE PS C:\> DeployMe 'https://www.website.com/file.ps1' Downloads .ps1 and runs it as admin .EXAMPLE PS C:\> DeployMe -URL 'https://www.website.com/file.ps1' Downloads .ps1 and runs it as admin .EXAMPLE PS C:\> DeployMe 'https://www.website.com/file.ps1' 'e:\restore' Downloads .ps1 and runs it as admin, saves 'e:\restore' to file named "~\restore.dir" .EXAMPLE PS C:\> DeployMe -URL 'https://www.website.com/file.ps1' -Restorefolder 'e:\restore' Downloads .ps1 and runs it as admin, saves 'e:\restore' to file named "~\restore.dir" #> [CmdletBinding()] param( [Parameter()] [string] $URL, [Parameter()] [string] $Restorefolder = 'NA' ) if (isURIWeb $URL) { Write-Output $restorefolder | out-file -FilePath "~\restore.dir" (New-Object System.Net.WebClient).DownloadFile($URL, "$env:TEMP\part1.ps1"); Start-Process -FilePath "powershell.exe" -ArgumentList "-executionpolicy bypass -File $env:TEMP\part1.ps1" -Verb RunAs } else { Write-Host 'NOT VALID URL' Pause } } function isURIWeb($address) { $uri = $address -as [System.URI] $null -ne $uri.AbsoluteURI -and $uri.Scheme -match '[http|https]' } function isURIFile($address) { $uri = $address -as [System.URI] $null -ne $uri.AbsoluteURI -and $uri.Scheme -match '[File|file]' } function Get-BAFile() { <# .SYNOPSIS Downloads files requiring Basic Authorization .DESCRIPTION Downloads files requiring Basic Authorization .PARAMETER URL URL to file .PARAMETER Path Path to save file .PARAMETER User Username .PARAMETER Pass Password .EXAMPLE PS C:\> Get-BAFile 'https://remotely.tom42.pw/Content/Remotely_Installer.exe' './Remotely_Installer.exe' 'tom42' '1tardis1' Downloads .ps1 and runs it as admin .EXAMPLE PS C:\> Get-BAFile -URL 'https://remotely.tom42.pw/Content/Remotely_Installer.exe' -PATH './Remotely_Installer.exe' -USER 'tom42' -PASS '1tardis1' Downloads .ps1 and runs it as admin #> [CmdletBinding()] param( [parameter(Mandatory = $True)] [string] $URL, [parameter(Mandatory = $True)] [string] $PATH, [parameter(Mandatory = $True)] [string] $USER, [parameter(Mandatory = $True)] [string] $PASS ) if ($PATH -eq 'NA') { Write-Host 'NOT VALID PATH'; exit } if ($PASS -eq 'NA') { Write-Host 'NOT VALID PASS'; exit } if ($USER -eq 'NA') { Write-Host 'NOT VALID USER'; exit } if (isURIWeb $URL) { $WebClient = New-Object System.Net.WebClient; $WebClient.Credentials = New-Object System.Net.Networkcredential($user, $pass) $WebClient.DownloadFile($url, $path) } else { Write-Host 'NOT VALID URL' Pause } } function Add-RunOnce { <# .SYNOPSIS Sets file as a runonce next time the system is rebooted .DESCRIPTION Sets file as a runonce next time the system is rebooted, this is used to setup next part of reinstall .PARAMETER Command File to run next boot .EXAMPLE PS C:\> Set-RunOnce 'https://www.website.com/file.ps1' #> [cmdletbinding()] param ( [string]$Command = '' ) $Command = $base + $Command $base = '%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file ' if (-not ((Get-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce).'Run' )) { New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce' -Name 'Run' -Value $Command -PropertyType ExpandString } else { Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce' -Name 'Run' -Value $Command -PropertyType ExpandString } } function Set-DefaultSetup { function Start-Sleep($seconds) { $doneDT = (Get-Date).AddSeconds($seconds) while ($doneDT -gt (Get-Date)) { $secondsLeft = $doneDT.Subtract((Get-Date)).TotalSeconds $percent = ($seconds - $secondsLeft) / $seconds * 100 Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining $secondsLeft -PercentComplete $percent [System.Threading.Thread]::Sleep(500) } Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining 0 -Completed } #download apps Install-Choco $dlfile = New-Object net.webclient $dlfile.Downloadfile("https://t0m.pw/tcmd", "$env:TEMP\tcmd.exe") $dlfile.Downloadfile("https://t0m.pw/wfc", "$env:TEMP\wfc6setup.exe") $dlfile.Downloadfile("https://t0m.pw/terminal", "$env:TEMP\Microsoft.WindowsTerminal.zip") choco install 7zip.install firefox notepadplusplus.install path-copy-copy winrar setdefaultbrowser try { Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force } catch { #Do Nothing } Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name BurntToast -Force Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted Install-Module -Name PolicyFileEditor -Force #install Total Commander start-process -FilePath "$env:TEMP\tcmd.exe" -ArgumentList "/AHL0GDUKFW0" -Wait Set-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Ghisler\Total Commander" -Name "IniFileName" -Value ".\wincmd.ini" -type String -erroraction SilentlyContinue Set-ItemProperty "HKLM:\SOFTWARE\Ghisler\Total Commander" -Name "IniFileName" -Value ".\wincmd.ini" -type String -erroraction SilentlyContinue Set-ItemProperty "HKCU:\SOFTWARE\Ghisler\Total Commander" -Name "IniFileName" -Value ".\wincmd.ini" -type String -erroraction SilentlyContinue New-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Ghisler\Total Commander" -Name "IniFileName" -Value ".\wincmd.ini" -type String -erroraction SilentlyContinue New-ItemProperty "HKLM:\SOFTWARE\Ghisler\Total Commander" -Name "IniFileName" -Value ".\wincmd.ini" -type String -erroraction SilentlyContinue New-ItemProperty "HKCU:\SOFTWARE\Ghisler\Total Commander" -Name "IniFileName" -Value ".\wincmd.ini" -type String -erroraction SilentlyContinue $wincmdini = 'W0NvbmZpZ3VyYXRpb25dDQpJbnN0YWxsRGlyPUM6XFByb2dyYW0gRmlsZXNcdG90YWxjbWQNClVzZU5ld0RlZkZvbnQ9MQ0KU2V0RW5jb2Rpbmc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lzbGVyLCBDLiBHaGlzbGVyICYgQ28uLCBhbGwgcmlnaHRzIHJlc2VydmVkLiBVbmF1dGhvcml6ZWQgY29weWluZyBwcm9oaWJpdGVkIQCI/lcvjbllY5//R9qXVB+fLg==' $wincmdkey = [System.Convert]::FromBase64String($wincmdkey) [System.IO.File]::WriteAllBytes("C:\Program Files\totalcmd\wincmd.key", $wincmdkey) #install Windows Firewall Control start-process -FilePath "$env:TEMP\wfc6setup.exe" -ArgumentList "-i -c" -Wait #install Windows Terminal Expand-Archive -LiteralPath "$env:TEMP\Microsoft.WindowsTerminal.zip" -DestinationPath $env:TEMP $UWPDesktop = (Get-ChildItem -file -Path "$env:TEMP" -Filter '*.UWPDesktop_14.*x64*').FullName Add-AppxPackage $UWPDesktop $UWPDesktop = (Get-ChildItem -file -Path "$env:TEMP" -Filter '*.msixbundle').FullName Add-AppxPackage $UWPDesktop #firefox Start-Process -FilePath "C:\Program Files\Mozilla Firefox\firefox.exe" Start-Sleep -s 3 Stop-Process -Name 'firefox' -Force get-firefoxfiles $configjs = [System.Convert]::FromBase64String($configjs) [System.IO.File]::WriteAllBytes("$Env:Programfiles\Mozilla Firefox\config.js", $configjs) $configprefsjs = [System.Convert]::FromBase64String($configprefsjs) [System.IO.File]::WriteAllBytes("$Env:Programfiles\Mozilla Firefox\defaults\pref\config-prefs.js", $configprefsjs) $FirefoxProfile = (Get-ChildItem -Directory -Path "$Env:USERPROFILE\AppData\Roaming\Mozilla\Firefox\Profiles" -Filter '*.default-release').FullName $FirefoxProfilecss = $FirefoxProfile + '\chrome.7z' $firefoxcss = [System.Convert]::FromBase64String($firefoxcss) [System.IO.File]::WriteAllBytes($FirefoxProfilecss, $firefoxcss) $FirefoxProfile = $FirefoxProfile + "/chrome" mkdir $FirefoxProfile $FirefoxProfile = "-o" + $FirefoxProfile 7z x $FirefoxProfilecss $FirefoxProfile Remove-Item $FirefoxProfilecss $FirefoxProfile = (Get-ChildItem -Directory -Path "$Env:USERPROFILE\AppData\Roaming\Mozilla\Firefox\Profiles" -Filter '*.default-release').FullName $FirefoxProfile = $FirefoxProfile + '\prefs.js' $prefsjs = @" user_pref("browser.compactmode.show", true); user_pref("browser.uidensity", 1); user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); "@ Add-Content -Path $FirefoxProfile -Value $prefsjs Start-Process -FilePath "SetDefaultBrowser.exe" -ArgumentList "HKLM Firefox-308046B0AF4A39CB" -Wait -PassThru -NoNewWindow } function Install-WinUpdate { try { Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force } catch { #Do Nothing } Try { get-command "Install-WindowsUpdate" -ErrorAction SilentlyContinue -ErrorVariable ModFail } Catch { Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module PSWindowsUpdate -Force Import-Module PSWindowsUpdate -Force } Get-WindowsUpdate Install-WindowsUpdate -AcceptAll -AutoReboot } function Get-IP { Set-Clipboard -Value ((Invoke-WebRequest -uri "http://ifconfig.me/ip").Content) (Invoke-WebRequest -uri "http://ifconfig.me/ip").Content } Function Set-WallPaper { <# .SYNOPSIS Applies a specified wallpaper to the current user's desktop .PARAMETER Image Provide the exact path to the image .PARAMETER Style Provide wallpaper style (Example: Fill, Fit, Stretch, Tile, Center, or Span) .EXAMPLE Set-WallPaper -Image "C:\Wallpaper\Default.jpg" Set-WallPaper -Image "C:\Wallpaper\Background.jpg" -Style Fit https://www.joseespitia.com/2017/09/15/set-wallpaper-powershell-function/ #> param ( [parameter(Mandatory = $True)] # Provide path to image [string]$Image, # Provide wallpaper style that you would like applied [parameter(Mandatory = $False)] [ValidateSet('Fill', 'Fit', 'Stretch', 'Tile', 'Center', 'Span')] [string]$Style ) $WallpaperStyle = Switch ($Style) { "Fill" { "10" } "Fit" { "6" } "Stretch" { "2" } "Tile" { "0" } "Center" { "0" } "Span" { "22" } } If ($Style -eq "Tile") { New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 1 -Force } Else { New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 0 -Force } Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; public class Params { [DllImport("User32.dll",CharSet=CharSet.Unicode)] public static extern int SystemParametersInfo (Int32 uAction, Int32 uParam, String lpvParam, Int32 fuWinIni); } "@ $SPI_SETDESKWALLPAPER = 0x0014 $UpdateIniFile = 0x01 $SendChangeEvent = 0x02 $fWinIni = $UpdateIniFile -bor $SendChangeEvent $ret = [Params]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $Image, $fWinIni) } function Install-Choco { Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") choco feature enable -n allowGlobalConfirmation } function Get-TimeBasedOneTimePassword { [CmdletBinding()] [Alias('Get-TOTP')] param ( #example t42_Get-TimeBasedOneTimePassword -SharedSecret 'YOHCC4TKKATXG2F4UJRU2J4AHK7YO2FO' # Base 32 formatted shared secret (RFC 4648). [Parameter(Mandatory = $true)] [System.String] $SharedSecret, # The date and time for the target calculation, default is now (UTC). [Parameter(Mandatory = $false)] [System.DateTime] $Timestamp = (Get-Date).ToUniversalTime(), # Token length of the one-time password, default is 6 characters. [Parameter(Mandatory = $false)] [System.Int32] $Length = 6, # The hash method to calculate the TOTP, default is HMAC SHA-1. [Parameter(Mandatory = $false)] [System.Security.Cryptography.KeyedHashAlgorithm] $KeyedHashAlgorithm = (New-Object -TypeName 'System.Security.Cryptography.HMACSHA1'), # Baseline time to start counting the steps (T0), default is Unix epoch. [Parameter(Mandatory = $false)] [System.DateTime] $Baseline = '1970-01-01 00:00:00', # Interval for the steps in seconds (TI), default is 30 seconds. [Parameter(Mandatory = $false)] [System.Int32] $Interval = 30 ) # Generate the number of intervals between T0 and the timestamp (now) and # convert it to a byte array with the help of Int64 and the bit converter. $numberOfSeconds = ($Timestamp - $Baseline).TotalSeconds $numberOfIntervals = [Convert]::ToInt64([Math]::Floor($numberOfSeconds / $Interval)) $byteArrayInterval = [System.BitConverter]::GetBytes($numberOfIntervals) [Array]::Reverse($byteArrayInterval) # Use the shared secret as a key to convert the number of intervals to a # hash value. $KeyedHashAlgorithm.Key = Convert-Base32ToByte -Base32 $SharedSecret $hash = $KeyedHashAlgorithm.ComputeHash($byteArrayInterval) # Calculate offset, binary and otp according to RFC 6238 page 13. $offset = $hash[($hash.Length - 1)] -band 0xf $binary = (($hash[$offset + 0] -band '0x7f') -shl 24) -bor (($hash[$offset + 1] -band '0xff') -shl 16) -bor (($hash[$offset + 2] -band '0xff') -shl 8) -bor (($hash[$offset + 3] -band '0xff')) $otpInt = $binary % ([Math]::Pow(10, $Length)) $otpStr = $otpInt.ToString().PadLeft($Length, '0') Write-Output $otpStr } function Convert-Base32ToByte { param ( [Parameter(Mandatory = $true)] [System.String] $Base32 ) # RFC 4648 Base32 alphabet $rfc4648 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' $bits = '' # Convert each Base32 character to the binary value between starting at # 00000 for A and ending with 11111 for 7. foreach ($char in $Base32.ToUpper().ToCharArray()) { $bits += [Convert]::ToString($rfc4648.IndexOf($char), 2).PadLeft(5, '0') } # Convert 8 bit chunks to bytes, ignore the last bits. for ($i = 0; $i -le ($bits.Length - 8); $i += 8) { [Byte] [Convert]::ToInt32($bits.Substring($i, 8), 2) } } function Switch-WindowsDefender { param ( [Parameter(ParameterSetName = 'enable')] [switch]$Enable, [Parameter(ParameterSetName = 'disable')] [switch]$Disable ) if ($Enable) { reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRealtimeMonitoring /f reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v SubmitSamplesConsent /f reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v SpynetRetporting /f reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /f } else { reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /t REG_DWORD /v DisableRealtimeMonitoring /d 1 /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /t REG_DWORD /v SubmitSamplesConsent /d 2 /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /t REG_DWORD /v SpynetRetporting /d 1 /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /t REG_DWORD /v DisableAntiSpyware /d 1 /f } } Function Export-Function { <# .Synopsis Exports a function from a module into a user given path .Description As synopsis .PARAMETER Function This Parameter takes a String input and is used in Both Parameter Sets .PARAMETER ResolvedFunction This should be passed the Function that you want to work with as an object making use of the following $ResolvedFunction = Get-Command "Command" .PARAMETER OutPath This is the location that you want to output all the module files to. It is recommended not to use the same location as where the module is installed. Also always check the files output what you expect them to. .PARAMETER PrivateFunction This is a switch that is used to correctly export Private Functions and is used internally in Export-AllModuleFunction .EXAMPLE Export-Function -Function Get-TwitterTweet -OutPath C:\TextFile\ This will export the function into the C:\TextFile\Get\Get-TwitterTweet.ps1 file and also create a basic test file C:\TextFile\Get\Get-TwitterTweet.Tests.ps1 .EXAMPLE Get-Command -Module SPCSPS | Where-Object {$_.CommandType -eq 'Function'} | ForEach-Object { Export-Function -Function $_.Name -OutPath C:\TextFile\SPCSPS\ } This will get all the Functions in the SPCSPS module (if it is loaded into memory or in a $env:PSModulePath as required by ModuleAutoLoading) and will export all the Functions into the C:\TextFile\SPCSPS\ folder under the respective Function Verbs. It will also create a basic Tests.ps1 file just like the prior example #> [cmdletbinding(DefaultParameterSetName = 'Basic')] Param( [Parameter(Mandatory = $true, ParameterSetName = 'Basic', ValueFromPipelineByPropertyName, ValueFromPipeline)] [Parameter(Mandatory = $true, ParameterSetName = 'Passthru', ValueFromPipelineByPropertyName, ValueFromPipeline)] [ValidateNotNullOrEmpty()] [ValidateNotNull()] [Alias('Command')] [Alias('Name')] [String] $Function, [Parameter(Mandatory = $true, ParametersetName = 'Passthru')] $ResolvedFunction, [Parameter(Mandatory = $true, ParameterSetName = 'Basic')] [Parameter(Mandatory = $true, ParameterSetName = 'Passthru')] [Alias('Path')] [String] $OutPath, [Parameter(Mandatory = $false, ParametersetName = 'Passthru')] [Alias('Private')] [Switch] $PrivateFunction ) $sb = New-Object -TypeName System.Text.StringBuilder If (!($ResolvedFunction)) { $ResolvedFunction = Get-Command $function } $code = $ResolvedFunction | Select-Object -ExpandProperty Definition $PublicOutPath = "$OutPath\" $ps1 = "$PublicOutPath$($ResolvedFunction.Verb)\$($ResolvedFunction.Name).ps1" foreach ($line in ($code -split '\r?\n')) { $sb.AppendLine('{0}' -f $line) | Out-Null } New-Item $ps1 -ItemType File -Force | Out-Null Write-Verbose -Message "Created File $ps1" Set-Content -Path $ps1 -Value $($sb.ToString()) -Encoding UTF8 Write-Verbose -Message "Added the content of function $Function into the file" } Function Install-OpenSSH { Param( [parameter(Mandatory = $false)] [String]$port = "22" ) Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 Start-Service sshd (Get-Content -ReadCount 0 "$env:ProgramData\ssh\sshd_config") -replace "#Port 22", "Port $port" | Set-Content "$env:ProgramData\ssh\sshd_config" (Get-Content -ReadCount 0 "$env:ProgramData\ssh\sshd_config") -replace "Match Group administrators", '' | Set-Content "$env:ProgramData\ssh\sshd_config" (Get-Content -ReadCount 0 "$env:ProgramData\ssh\sshd_config") -replace " AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys", '' | Set-Content "$env:ProgramData\ssh\sshd_config" Remove-NetFirewallRule -DisplayName 'OpenSSH SSH Server (sshd)' Restart-Service sshd Set-Service -Name sshd -StartupType 'Automatic' New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort $port } Function Set-tom42 { } Function Get-IniFile ($file) { $ini = @{} $section = "NO_SECTION" $ini[$section] = @{} switch -regex -file $file { "^\[(.+)\]$" { $section = $matches[1].Trim() $ini[$section] = @{} } "^\s*([^#].+?)\s*=\s*(.*)" { $name, $value = $matches[1..2] # skip comments that start with semicolon: if (!($name.StartsWith(";"))) { $ini[$section][$name] = $value.Trim() } } } $ini } function Backup-Firefox { [CmdletBinding()] param( [parameter(Mandatory = $false)] [string] $OUTFOLDER ) function Start-Sleep($seconds) { $doneDT = (Get-Date).AddSeconds($seconds) while ($doneDT -gt (Get-Date)) { $secondsLeft = $doneDT.Subtract((Get-Date)).TotalSeconds $percent = ($seconds - $secondsLeft) / $seconds * 100 Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining $secondsLeft -PercentComplete $percent [System.Threading.Thread]::Sleep(500) } Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining 0 -Completed } $firefox = Get-Process firefox -ErrorAction SilentlyContinue if ($firefox) { $firefox | Stop-Process -Force } Start-Sleep -Seconds 3 Confirm-choco -exe "7z" -package "7zip.install" $CurrentPath = (Get-Location).path $profilepath = ("$env:APPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') if (test-path "$profilepath\chrome" -PathType Container) { $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\chrome.7z" + '" -r "' + "$profilepath\chrome\*" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } $extensionsJSON = Get-Content -Raw "$profilepath\extensions.json" | ConvertFrom-Json $i = 0 foreach ($EXT in $extensionsJSON.addons) { if ($extensionsJSON.addons[$i].active -eq $true) { if ($extensionsJSONsuncle2 = $extensionsJSON.addons[$i].path) { New-Item -Path "$CurrentPath\activeextensions" -ItemType Directory -Force -ErrorAction SilentlyContinue $extensionsJSONsuncle = $extensionsJSON.addons[$i].id $extensionsJSONsuncle2 = $extensionsJSON.addons[$i].path Copy-Item -Path $extensionsJSONsuncle2 -Destination "$CurrentPath\activeextensions\$extensionsJSONsuncle.xpi" } } else { if ($extensionsJSONsuncle2 = $extensionsJSON.addons[$i].path) { New-Item -Path "$CurrentPath\extensions" -ItemType Directory -Force -ErrorAction SilentlyContinue $extensionsJSONsuncle = $extensionsJSON.addons[$i].id $extensionsJSONsuncle2 = $extensionsJSON.addons[$i].path Copy-Item -Path $extensionsJSONsuncle2 -Destination "$CurrentPath\extensions\$extensionsJSONsuncle.xpi" } } $i++ } Remove-Item -Path "$CurrentPath\extensions\formautofill@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\pictureinpicture@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\screenshots@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\webcompat-reporter@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\webcompat@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\default-theme@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\addons-search-detection@mozilla.com.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\google@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\amazondotcom@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\wikipedia@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\bing@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\ddg@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\firefox-compact-light@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\firefox-compact-dark@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\firefox-alpenglow@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\extensions\ebay@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\formautofill@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\pictureinpicture@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\screenshots@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\webcompat-reporter@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\webcompat@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\default-theme@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\addons-search-detection@mozilla.com.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\google@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\amazondotcom@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\wikipedia@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\bing@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\ddg@search.mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\firefox-compact-light@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\firefox-compact-dark@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\firefox-alpenglow@mozilla.org.xpi" -ErrorAction SilentlyContinue Remove-Item -Path "$CurrentPath\activeextensions\ebay@search.mozilla.org.xpi" -ErrorAction SilentlyContinue $ProfileFileName = Get-Date -Format FileDateTime | ForEach-Object { $_ -replace ":", "." } $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\activeextensions.7z" + '" "' + "$CurrentPath\activeextensions\*" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\extensions.7z" + '" "' + "$CurrentPath\extensions\*" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow New-Item -Path "$CurrentPath\ExtensionSettings" -ItemType Directory -Force -ErrorAction SilentlyContinue $profilepath = ("$env:APPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') $moz_extension = $profilepath + "\storage\default\moz-extension*" $moz_extensionList = Get-ChildItem -Path $moz_extension -Directory foreach ($FILE in $moz_extensionList) { New-Item -Path "$CurrentPath\ExtensionSettings\$($FILE.Name)" -ItemType Directory -Force -ErrorAction SilentlyContinue Copy-Item -Path "$($FILE.FullName)\*" -Destination "$CurrentPath\ExtensionSettings\$($FILE.Name)" -Recurse } $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\ExtensionSettings.7z" + '" -r "' + "$CurrentPath\ExtensionSettings\*" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow $filelist = New-Object System.Collections.ArrayList $Localprofilepath = ("$env:LOCALAPPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') if (Test-Path -Path "$CurrentPath\extensions.7z") { $filelist.Add("$CurrentPath\extensions.7z") } if (Test-Path -Path "$Localprofilepath\startupCache\webext.sc.lz4") { $filelist.Add("$Localprofilepath\startupCache\webext.sc.lz4") } if (Test-Path -Path "$CurrentPath\chrome.7z") { $filelist.Add("$CurrentPath\chrome.7z") } if (Test-Path -Path "$CurrentPath\ExtensionSettings.7z") { $filelist.Add("$CurrentPath\ExtensionSettings.7z") } if (Test-Path -Path "$CurrentPath\activeextensions.7z") { $filelist.Add("$CurrentPath\activeextensions.7z") } if (Test-Path -Path "$CurrentPath\disabled-extensions.txt") { $filelist.Add("$CurrentPath\disabled-extensions.txt") } if (Test-Path -Path "$CurrentPath\extensions.txt") { $filelist.Add("$CurrentPath\extensions.txt") } if (Test-Path -Path "$profilepath\containers.json") { $filelist.Add("$profilepath\containers.json") } if (Test-Path -Path "$profilepath\prefs.js") { $filelist.Add("$profilepath\prefs.js") } if (Test-Path -Path "$profilepath\xulstore.json") { $filelist.Add("$profilepath\xulstore.json") } if (Test-Path -Path "$profilepath\sessionstore.jsonlz4") { $filelist.Add("$profilepath\sessionstore.jsonlz4") } if (Test-Path -Path "$profilepath\handlers.json") { $filelist.Add("$profilepath\handlers.json") } if (Test-Path -Path "$profilepath\pkcs11.txt") { $filelist.Add("$profilepath\pkcs11.txt") } if (Test-Path -Path "$profilepath\cert9.db") { $filelist.Add("$profilepath\cert9.db") } if (Test-Path -Path "$profilepath\chromeappsstore.sqlite") { $filelist.Add("$profilepath\chromeappsstore.sqlite") } if (Test-Path -Path "$profilepath\cookies.sqlite") { $filelist.Add("$profilepath\cookies.sqlite") } if (Test-Path -Path "$profilepath\formhistory.sqlite") { $filelist.Add("$profilepath\formhistory.sqlite") } if (Test-Path -Path "$profilepath\persdict.dat") { $filelist.Add("$profilepath\persdict.dat") } if (Test-Path -Path "$profilepath\search.json.mozlz4") { $filelist.Add("$profilepath\search.json.mozlz4") } if (Test-Path -Path "$profilepath\content-prefs.sqlite") { $filelist.Add("$profilepath\content-prefs.sqlite") } if (Test-Path -Path "$profilepath\permissions.sqlite") { $filelist.Add("$profilepath\permissions.sqlite") } if (Test-Path -Path "$profilepath\logins.json") { $filelist.Add("$profilepath\logins.json") } if (Test-Path -Path "$profilepath\key4.db") { $filelist.Add("$profilepath\key4.db") } if (Test-Path -Path "$profilepath\favicons.sqlite") { $filelist.Add("$profilepath\favicons.sqlite") } if (Test-Path -Path "$profilepath\places.sqlite") { $filelist.Add("$profilepath\places.sqlite") } if (Test-Path -Path "$profilepath\extension-preferences.jsone") { $filelist.Add("$profilepath\extension-preferences.json") } if (Test-Path -Path "$profilepath\extension-settings.json") { $filelist.Add("$profilepath\extension-settings.json") } if (Test-Path -Path "$profilepath\storage-sync-v2.sqlite-shm") { $filelist.Add("$profilepath\storage-sync-v2.sqlite-shm") } if (Test-Path -Path "$profilepath\storage-sync-v2.sqlite-wal") { $filelist.Add("$profilepath\storage-sync-v2.sqlite-wal") } if (Test-Path -Path "$profilepath\storage-sync-v2.sqlite") { $filelist.Add("$profilepath\storage-sync-v2.sqlite") } if (Test-Path -Path "$profilepath\webappsstore.sqlite") { $filelist.Add("$profilepath\webappsstore.sqlite") } $filelist | Out-File "$CurrentPath\filelist.txt" -Encoding utf8 $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\Firefox-Profile-Backup-$ProfileFileName.7z" + '" @"' + "$CurrentPath\filelist.txt" + '"' if ($OUTFOLDER) { $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$OUTFOLDER\Firefox-Profile-Backup-$ProfileFileName.7z" + '" @"' + "$CurrentPath\filelist.txt" + '"' } Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow Remove-Item -Path "$CurrentPath\extensions" -Recurse -Force Remove-Item -Path "$CurrentPath\activeextensions" -Recurse -Force Remove-Item -Path "$CurrentPath\ExtensionSettings" -Recurse -Force Remove-Item -Path "$CurrentPath\activeextensions.7z" -Recurse -Force Remove-Item -Path "$CurrentPath\extensions.7z" -Recurse -Force Remove-Item -Path "$CurrentPath\filelist.txt" -Recurse -Force Remove-Item -Path "$CurrentPath\ExtensionSettings.7z" -Recurse -Force Remove-Item -Path "$CurrentPath\chrome.7z" -Recurse -Force if ($firefox) { $FirefoxVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox" -Name CurrentVersion).CurrentVersion $FirefoxEXE = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox\$FirefoxVersion\Main" -Name PathToExe).PathToExe Start-Process -FilePath $FirefoxEXE } } function Confirm-choco { [CmdletBinding()] param( [parameter(Mandatory = $True)] [string] $exe, [parameter(Mandatory = $True)] [string] $package ) if (-not(Get-Command "$exe" -errorAction SilentlyContinue)) { Write-Output "Not Installed" if (-not(get-command "choco" -ErrorAction SilentlyContinue)) { Write-Output "Choco not Installed" Install-Choco } choco install $package } Write-Output "Installed" } function Confirm-Package { [CmdletBinding()] param( [parameter(Mandatory = $True)] [string] $exe, [parameter(Mandatory = $True)] [string] $package ) if (-not(Get-Command "$exe" -errorAction SilentlyContinue)) { Set-executionpolicy -Force -executionpolicy unrestricted; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Install-Module -Name $package -Force } } function get-firefoxfiles { $Global:configjs = 'Ly8gc2tpcCAxc3QgbGluZQpsb2NrUHJlZigneHBpbnN0YWxsLnNpZ25hdHVyZXMucmVxdWlyZWQnLCBmYWxzZSk7CgpPYmplY3QgPSBDdS5nZXRHbG9iYWxGb3JP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mandatory = $True)] [alias("f")] [string]$FILE, [parameter(Mandatory = $false)] [alias("s")] [Switch]$silent = $false ) Confirm-Package "Set-PolicyFileEntry" "PolicyFileEditor" Confirm-choco -exe "7z" -package "7zip.install" Confirm-choco -exe "SetDefaultBrowser" -package "SetDefaultBrowser" #start firefox $firefox = Get-Process firefox -ErrorAction SilentlyContinue if ($firefox) { $firefox | Stop-Process -Force } else { if (Test-Path -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox") { $FirefoxVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox" -Name CurrentVersion).CurrentVersion } if (Test-Path -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox\$FirefoxVersion\Main") { $FirefoxEXE = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox\$FirefoxVersion\Main" -Name PathToExe).PathToExe } if ($FirefoxEXE) { Start-Process -FilePath $FirefoxEXE Start-GUItimer-Sleep -s 10 Stop-Process -Name 'firefox' -Force } else { choco install firefox Start-GUItimer-Sleep -s 10 $FirefoxVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox" -Name CurrentVersion).CurrentVersion $FirefoxEXE = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox\$FirefoxVersion\Main" -Name PathToExe).PathToExe Start-Process -FilePath $FirefoxEXE Start-GUItimer-Sleep -s 10 Stop-Process -Name 'firefox' -Force } } #stop firefox Start-Process -FilePath "SetDefaultBrowser.exe" -ArgumentList "HKLM Firefox-308046B0AF4A39CB" -Wait -PassThru -NoNewWindow [string]$BackupTempFolder = Join-Path -Path ([IO.Path]::GetTempPath()) -ChildPath ([System.IO.Path]::GetRandomFileName().Split('.')[0] + "\") New-Item -Path $BackupTempFolder -ItemType Directory -Force $ArgumentList = 'x "' + "$FILE" + '" -o"' + "$BackupTempFolder" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow if (Test-Path -Path "$BackupTempFolder\chrome.7z" -PathType Leaf) { get-firefoxfiles $configjs = [System.Convert]::FromBase64String($configjs) [System.IO.File]::WriteAllBytes("$Env:Programfiles\Mozilla Firefox\config.js", $configjs) $configprefsjs = [System.Convert]::FromBase64String($configprefsjs) [System.IO.File]::WriteAllBytes("$Env:Programfiles\Mozilla Firefox\defaults\pref\config-prefs.js", $configprefsjs) $FirefoxProfile = ("$env:APPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') $FirefoxProfilecss = $FirefoxProfile + '\chrome.7z' $firefoxcss = [System.Convert]::FromBase64String($firefoxcss) [System.IO.File]::WriteAllBytes($FirefoxProfilecss, $firefoxcss) New-Item -Path "$FirefoxProfile\chrome" -ItemType Directory -Force $ArgumentList = 'x "' + "$FirefoxProfile\chrome.7z" + '" -aoa -o"' + "$FirefoxProfile\chrome" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow Remove-Item -Path "$FirefoxProfile\chrome.7z" -Force $ArgumentList = 'x "' + "$BackupTempFolder\chrome.7z" + '" -aoa -o"' + "$FirefoxProfile\chrome" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow Remove-Item -Path "$BackupTempFolder\chrome.7z" -Force } if (Test-Path -Path "$BackupTempFolder\ExtensionSettings.7z" ) { $FirefoxProfile = ("$env:APPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') $FirefoxProfileES = "$FirefoxProfile\storage\default\" $ArgumentList = 'x "' + "$BackupTempFolder\ExtensionSettings.7z" + '" -aoa -o"' + "$FirefoxProfileES" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow Remove-Item -Path "$BackupTempFolder\ExtensionSettings.7z" -Force } #disabled Start if (test-path -Path "$BackupTempFolder\extensions.7z") { [string]$DisableExtensionsFolder = Join-Path -Path ([IO.Path]::GetTempPath()) -ChildPath ([System.IO.Path]::GetRandomFileName().Split('.')[0] + "\") New-Item -Path $DisableExtensionsFolder -ItemType Directory -Force $ArgumentList = 'x "' + "$BackupTempFolder\extensions.7z" + '" -o"' + "$DisableExtensionsFolder" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow Remove-Item -Path "$BackupTempFolder\extensions.7z" -Force $XPIList = Get-ChildItem -Path "$DisableExtensionsFolder*" -Include ("*.xpi") -ErrorAction SilentlyContinue -Force | ForEach-Object { $_.fullname } $profilepath = ("$env:APPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') New-Item -Path "$profilepath\extensions" -ItemType Directory -Force foreach ($file in $XPIList) { Copy-Item -Path $file -Destination "$profilepath\extensions" } $FirefoxVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox" -Name CurrentVersion).CurrentVersion $FirefoxEXE = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox\$FirefoxVersion\Main" -Name PathToExe).PathToExe Start-Process -FilePath $FirefoxEXE Start-GUItimer-Sleep -Seconds 10 $firefox = Get-Process firefox -ErrorAction SilentlyContinue if ($firefox) { $firefox | Stop-Process -Force } Remove-Item -Path $DisableExtensionsFolder -Recurse -Force } #disabled end #Active Start if (test-path -Path "$BackupTempFolder\activeextensions.7z") { [string]$ActiveExtensionsFolder = Join-Path -Path ([IO.Path]::GetTempPath()) -ChildPath ([System.IO.Path]::GetRandomFileName().Split('.')[0] + "\") New-Item -Path $ActiveExtensionsFolder -ItemType Directory -Force $ArgumentList = 'x "' + "$BackupTempFolder\activeextensions.7z" + '" -o"' + "$ActiveExtensionsFolder" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow Remove-Item -Path "$BackupTempFolder\activeextensions.7z" -Force $XPIList = Get-ChildItem -Path "$ActiveExtensionsFolder*" -Include ("*.xpi") -ErrorAction SilentlyContinue -Force | ForEach-Object { $_.fullname } $RegType = 'ExpandString' $UserDir = "$env:windir\system32\GroupPolicy\User\registry.pol" $RegPath = 'Software\Policies\Mozilla\Firefox\Extensions\Install' $RegName = 1 foreach ($RegData in $XPIList) { Set-PolicyFileEntry -Path $UserDir -Key $RegPath -ValueName $RegName.ToString() -Data $RegData -Type $RegType $RegName++ } Start-Process -FilePath "gpupdate.exe" -ArgumentList "/force" -Wait -PassThru -NoNewWindow $FirefoxVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox" -Name CurrentVersion).CurrentVersion $FirefoxEXE = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox\$FirefoxVersion\Main" -Name PathToExe).PathToExe Start-Process -FilePath $FirefoxEXE Start-GUItimer-Sleep -Seconds 20 Stop-Process -Name 'firefox' -Force Remove-Item -Path $ActiveExtensionsFolder -Recurse -Force } #Active end $fileList = Get-ChildItem -Path "$BackupTempFolder*" -Include ("*.*") -Exclude "webext.sc.lz4" -ErrorAction SilentlyContinue -Force | ForEach-Object { $_.fullname } $profilepath = ("$env:APPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') Start-GUItimer-Sleep -seconds 10 Remove-Item -Path "$profilepath\*sqlite-shm" -Force Remove-Item -Path "$profilepath\*sqlite-wal" -Force foreach ($file in $fileList) { Copy-Item -Path $file -Destination $profilepath -Force } $FirefoxVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox" -Name CurrentVersion).CurrentVersion $FirefoxEXE = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox\$FirefoxVersion\Main" -Name PathToExe).PathToExe Start-Process -FilePath $FirefoxEXE Start-GUItimer-Sleep -Seconds 45 Stop-Process -Name 'firefox' -Force $Localprofilepath = ("$env:LOCALAPPDATA\Mozilla\Firefox\") + ((Get-IniFile "$env:APPDATA\Mozilla\Firefox\profiles.ini").Profile0.Path).replace('/', '\') Copy-Item -Path "$BackupTempFolder\webext.sc.lz4" -Destination "$Localprofilepath\startupCache\webext.sc.lz4" -Force Remove-Item -Path "$BackupTempFolder" -Force -Recurse if ($silent -eq $false) { [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null [System.Windows.Forms.MessageBox]::Show('Firefox Restore Complete', 'DONE') } else { Write-Host "DONE" } } function Backup-Factorio { Confirm-choco -exe "7z" -package "7zip.install" $CurrentPath = (Get-Location).path $datestamp = Get-Date -Format FileDateTime | ForEach-Object { $_ -replace ":", "." } $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\Factorio-Backup-$datestamp.7z" + '" "' + "c:\Users\$env:UserName\AppData\Roaming\Factorio\*" + '" -r' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } function Restore-Factorio { [CmdletBinding()] param( [parameter(Mandatory = $True)] [string] $FILE ) Confirm-choco -exe "7z" -package "7zip.install" if (Test-Path -Path "c:\Users\$env:UserName\AppData\Roaming\Factorio") { Remove-Item -Path "c:\Users\$env:UserName\AppData\Roaming\Factorio\*" -Recurse -Force } else { New-Item -Path "c:\Users\$env:UserName\AppData\Roaming\Factorio" -ItemType Directory -Force } $ArgumentList = 'x "' + "$FILE" + '" -o"' + "c:\Users\$env:UserName\AppData\Roaming\Factorio" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } function Backup-COI { Confirm-choco -exe "7z" -package "7zip.install" $CurrentPath = (Get-Location).path $datestamp = Get-Date -Format FileDateTime | ForEach-Object { $_ -replace ":", "." } $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\Captain_of_Industry-Backup-$datestamp.7z" + '" "' + "c:\Users\$env:UserName\Documents\Captain of Industry\*" + '" -r' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } function Restore-COI { [CmdletBinding()] param( [parameter(Mandatory = $True)] [string] $FILE ) Confirm-choco -exe "7z" -package "7zip.install" if (Test-Path -Path "c:\Users\$env:UserName\Documents\Captain of Industry") { Remove-Item -Path "c:\Users\$env:UserName\Documents\Captain of Industry\*" -Recurse -Force } else { New-Item -Path "c:\Users\$env:UserName\Documents\Captain of Industry" -ItemType Directory -Force } $ArgumentList = 'x "' + "$FILE" + '" -o"' + "c:\Users\$env:UserName\Documents\Captain of Industry" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } function Backup-LocalGitHub { Confirm-choco -exe "7z" -package "7zip.install" $CurrentPath = (Get-Location).path $datestamp = Get-Date -Format FileDateTime | ForEach-Object { $_ -replace ":", "." } $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\Documents_Github-Backup-$datestamp.7z" + '" "' + "c:\Users\$env:UserName\Documents\GitHub\*" + '" -r' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } function Restore-LocalGitHub { [CmdletBinding()] param( [parameter(Mandatory = $True)] [string] $FILE, [Alias('o')] [Switch]$overwrite = $false ) Confirm-choco -exe "7z" -package "7zip.install" if (Test-Path -Path "c:\Users\$env:UserName\Documents\GitHub") { if ($overwrite) { $ArgumentList = 'x "' + "$FILE" + '" -o"' + "c:\Users\$env:UserName\Documents\GitHub" + '" -aoa' } else { $ArgumentList = 'x "' + "$FILE" + '" -o"' + "c:\Users\$env:UserName\Documents\GitHub" + '" -aos' } Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } else { New-Item -Path "c:\Users\$env:UserName\Documents\GitHub" -ItemType Directory -Force $ArgumentList = 'x "' + "$FILE" + '" -o"' + "c:\Users\$env:UserName\Documents\GitHub" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } } function Restore-PathBackup { [CmdletBinding()] param( [parameter(Mandatory = $True)] [string] $FILE, [parameter(Mandatory = $false)] [Alias('d')] [string] $rootdrive = 'c' ) Confirm-choco -exe "7z" -package "7zip.install" $DFILE = Get-ChildItem $FILE $RestorePath = Join-Path ($rootdrive + ":\") (($dfile.basename).Replace("~", "\").Replace("_", " ") -Split "-")[0] if (-not(Test-Path -Path $RestorePath)) { New-Item -Path $RestorePath -ItemType Directory -Force } $ArgumentList = 'x "' + "$FILE" + '" -o"' + "$RestorePath" + '"' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow } function Backup-tom42 { Confirm-choco -exe "7z" -package "7zip.install" $CurrentPath = (Get-Location).path $datestamp = Get-Date -Format FileDateTime | ForEach-Object { $_ -replace ":", "." } ## c:\Users\tom42\Documents\My Digital Editions\ $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\Users~tom42~Documents~My_Digital_Editions-Backup-$datestamp.7z" + '" "' + "c:\Users\$env:UserName\Documents\My Digital Editions\*" + '" -r' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow ## c:\Users\tom42\Documents\My Kindle Content\ $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\Users~tom42~Documents~My_Kindle_Content-Backup-$datestamp.7z" + '" "' + "c:\Users\$env:UserName\Documents\My Kindle Content\*" + '" -r' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow ## c:\totalcmd\ $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\totalcmd-Backup-$datestamp.7z" + '" "' + "c:\totalcmd\*" + '" -r' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow ## c:\PATH\ $ArgumentList = 'a -spm -m0=lzma2 -mx=9 -mfb=64 -md=256m "' + "$CurrentPath\PATH-Backup-$datestamp.7z" + '" "' + "c:\PATH\*" + '" -r' Start-Process -FilePath "7z" -ArgumentList $ArgumentList -Wait -NoNewWindow $pw7exe = (get-command pwsh).source $pw5exe = (get-command powershell).source &$pw7exe -Command "echo (Get-InstalledModule).name" | convertto-json | out-file "Powershell7Modules-Backup-$datestamp.json" &$pw5exe -Command "echo (Get-InstalledModule).name" | convertto-json | out-file "Powershell5Modules-Backup-$datestamp.json" choco export "packages.xml" (Select-Xml -Path "packages.xml" -XPath '/packages').node.package.id | ConvertTo-Json | out-file "ChocoPackages-Backup-$datestamp.json" Remove-Item -Path "packages.xml" } function Start-Timer-Sleep($seconds) { $doneDT = (Get-Date).AddSeconds($seconds) while ($doneDT -gt (Get-Date)) { $secondsLeft = $doneDT.Subtract((Get-Date)).TotalSeconds $percent = ($seconds - $secondsLeft) / $seconds * 100 Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining $secondsLeft -PercentComplete $percent [System.Threading.Thread]::Sleep(500) } Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining 0 -Completed } function Start-GUItimer-Sleep { [CmdletBinding()] param( [parameter(Mandatory = $True)] [int] [alias("s")] [alias("seconds")] $RebootT, [parameter(Mandatory = $false)] [string] [alias("m")] $Message = "", [parameter(Mandatory = $false)] [string] [alias("t")] $Title = "PowerShell Countdown" ) # This removes the use of the close "x" button on the pop-up countodwn box the users will see $code = @' using System; using System.Runtime.InteropServices; namespace CloseButtonToggle { internal static class WinAPI { [DllImport("kernel32.dll")] internal static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool DeleteMenu(IntPtr hMenu, uint uPosition, uint uFlags); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool DrawMenuBar(IntPtr hWnd); [DllImport("user32.dll")] internal static extern IntPtr GetSystemMenu(IntPtr hWnd, [MarshalAs(UnmanagedType.Bool)]bool bRevert); const uint SC_CLOSE = 0xf060; const uint MF_BYCOMMAND = 0; internal static void ChangeCurrentState(bool state) { IntPtr hMenu = GetSystemMenu(GetConsoleWindow(), state); DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND); DrawMenuBar(GetConsoleWindow()); } } public static class Status { public static void Disable() { WinAPI.ChangeCurrentState(false); //its 'true' if need to enable } } } '@ Add-Type $code [CloseButtonToggle.Status]::Disable() Add-Type -assembly System.Windows.Forms $height = 150 $width = 400 $color = "White" #Create the form for the countdown box $form1 = New-Object System.Windows.Forms.Form -Property @{TopMost = $true } $form1.Text = $title $form1.Height = $height $form1.Width = $width $form1.BackColor = $color $form1.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedSingle $form1.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen $label1 = New-Object system.Windows.Forms.Label $label1.Text = "Not started" $label1.Left = 10 $label1.Top = 70 $label1.Width = $width - 20 $label1.Height = 15 $label1.Font = "Verdana" $form1.controls.add($label1) $label2 = New-Object system.Windows.Forms.Label $label2.Text = $Message $label2.Left = 10 $label2.Top = 10 $label2.Width = $width - 40 $label2.Height = 70 $label2.Font = "Verdana" $form1.controls.add($label2) $progressBar1 = New-Object System.Windows.Forms.ProgressBar $progressBar1.Name = 'progressBar1' $progressBar1.Value = 0 #$progressBar1.Style = "Continuous" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Width = $width - 40 $System_Drawing_Size.Height = 15 $progressBar1.Size = $System_Drawing_Size $progressBar1.Left = 10 $progressBar1.Top = 90 $form1.Controls.Add($progressBar1) $form1.Show() | Out-Null $form1.Focus() | Out-Null $form1.Refresh() $Seconds = 1..$RebootT $i = 0 # The countdown timer ForEach ($Sec in $Seconds) { $i++ [int]$pct = ($i / $Seconds.Count) * 100 $SecLeft = $Seconds.Count - $i $Min = [Int](([String]($SecLeft / 60)).split('.')[0]) $progressbar1.Value = $pct $label1.text = "$Min" + " minutes " + ($SecLeft % 60) + " seconds left until done..." $form1.Refresh() Start-Sleep -Seconds 1 } $form1.Close() } |