################################################################################################################ ### ### ### WARNING: This file is automatically generated DO NOT modify this file directly as it will be overwritten ### ### ### ################################################################################################################ <# .NOTES Author : MyDrift @mydrift-user GitHub : https://github.com/mydrift-user ? : pnp powershell instead of Get-Credential? TODO : create session without prequisits on remote machine TODO : delete logs older than 30 days | create config for that (checkbox in settings tab (rename sources to settings) rename sources as subtab) TODO : package as .exe (github & website) TODO : save an additional script and put it in task scheduler. after 30 days of not running the script it deleats the logs, the task and itself. TODO : Run on system boot -> task scheduler checks for windows version change and then runs the selected/needed tweaks. #> # check if codes are running in an elevated session. if not, restart the script in an elevated session if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { # If not elevated, relaunch the script in a new elevated PowerShell session #TODO save script in directory, change escapedcommand to run that saved script instead of rerequest code. $escapedCommand = 'irm mdiana.win | iex' Start-Process PowerShell -ArgumentList "-Command", $escapedCommand -Verb RunAs exit } Write-Host " MMMMMMMM MMMMMMMM DDDDDDDDDDDDDD M:::::::M M:::::::M D:::::::::::::DDD M::::::::M M::::::::M D::::::::::::::::DD M:::::::::M M:::::::::M DDD:::::DDDDD::::::D M::::::::::M M::::::::::M D:::::D D::::::D M:::::::::::M M:::::::::::M D:::::D D::::::D M:::::::M::::M M::::M:::::::M D:::::D D::::::D M::::::M M::::M M::::M M::::::M D:::::D D::::::D M::::::M M::::M::::M M::::::M D:::::D D::::::D M::::::M M:::::::M M::::::M D:::::D D::::::D M::::::M M:::::M M::::::M D:::::D D::::::D M::::::M MMMMM M::::::M D:::::D D::::::D M::::::M M::::::M DDD:::::DDDDD::::::D M::::::M M::::::M D::::::::::::::::DD M::::::M M::::::M D:::::::::::::DDD MMMMMMMM MMMMMMMM DDDDDDDDDDDDDD ========Mattia Diana======== =====Powershell Toolbox===== =======Managing Device====== " $directory = "C:\Windows\WinToolBox" # Check if the logs subdirectory exists within the main directory and create it if it doesn't if (-not (Test-Path -Path "$directory\Logs")) { New-Item -Path "$directory\Logs" -ItemType Directory -Force | Out-Null } $dateTime = Get-Date -Format "dd-MM-yyyy_HH-mm-ss" Start-Transcript -Path "$directory\Logs\WinToolBox_$dateTime.log" -Append function Get-JsonConfig { param ( [string]$ConfigPath = "$directory\config.json" ) if (Test-Path -Path $ConfigPath) { $json = Get-Content -Path $ConfigPath -Raw | ConvertFrom-Json return $json } else { return $null } } function Set-JsonConfig { param ( [Parameter(Mandatory)] [PSCustomObject]$JsonData, [string]$ConfigPath = "$directory\config.json" ) $JsonData | ConvertTo-Json -Depth 5 | Set-Content -Path $ConfigPath } # Load WPF and XAML libraries Add-Type -AssemblyName PresentationCore, WindowsBase, PresentationFramework, System.Drawing, WindowsFormsIntegration # WPF GUI Design in XAML [xml]$xaml = @"