Microsoft Powertoys
winget install Microsoft.PowerToys --source winget
Allowing Scripts to be run
To solve: Solution for “cannot be loaded because running scripts is disabled on this system“:
Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth
sfc /scannow
robocopy /move /e /s /w:99 /r:10 [from] [to] /l
PS C:\pomerium> netstat -ano -p tcp | find """200"""
TCP 10.81.135.240:54184 13.107.21.200:443 ESTABLISHED 9472
TCP 10.81.135.240:62618 204.79.197.200:443 ESTABLISHED 11812
TCP 127.0.0.1:20080 0.0.0.0:0 LISTENING 18668
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$ErrorActionPreference = 'SilentlyContinue'
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator'))
{
Start-Process powershell.exe "-NoProfile -windowstyle hidden -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
Exit
}
$Form = New-Object system.Windows.Forms.Form
$Form.ClientSize = New-Object System.Drawing.Point(300,150)
$Form.text = "Script rename By Julian Naylor"
$Form.StartPosition = "CenterScreen"
$Form.TopMost = $false
$Form.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#e9e9e9")
$Form.AutoScaleDimensions = '192, 192'
$Form.AutoScaleMode = "Dpi"
$Form.AutoSize = $True
$Form.AutoScroll = $True
$Form.ClientSize = '300,300'
$Form.FormBorderStyle = 'FixedSingle'
$Panel1 = 150
$Panel1.width = 150
$Panel1.location = New-Object System.Drawing.Point(6,54)
$runsc = New-Object System.Windows.Forms.Button
$runsc.Text = "Run script"
$runsc.Width = 212
$runsc.height = 30
$runsc.Location = New-Object System.Drawing.Size(0,5)
$runsc.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12)
$Form.Controls.Add($runsc)
$ResultText = New-Object system.Windows.Forms.TextBox
$ResultText.multiline = $true
$ResultText.width = 382
$ResultText.height = 130
$ResultText.location = New-Object System.Drawing.Point(0,155)
$ResultText.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',12)
$Form.controls.AddRange(@($Panel1,$ResultText))
$Panel1.controls.AddRange(@($runsc))
Function Add-OutputBoxLine {
Param ($Message)
$ResultText.AppendText("`r`n$Message")
$ResultText.Refresh()
$ResultText.ScrollToCaret()
}
############Sets computer name#################
$runsc.Add_Click({
Function get-devicetype
{
Param(
[string]$unit = “localhost”
)
$result = $false
if(Get-WmiObject -Class win32_systemenclosure -ComputerName $unit |
Where-Object { $_.chassistypes -eq 9 -or $_.chassistypes -eq 10 `
-or $_.chassistypes -eq 14})
{ $result = $true }
if(Get-WmiObject -Class win32_battery -ComputerName $unit)
{ $result = $true }
$result
}
$type = If(get-devicetype) { “L” }
else { “D”}
$SerialNumber = (Get-WmiObject -class win32_bios).SerialNumber
$name = "test-$SerialNumber-$type" ###############<---this is the computer name entry change test to the name of company##
Rename-Computer -NewName $name -Force
Add-OutputBoxLine -Message "computer renamed to test-$SerialNumber-$type"#cosmetic for result text when script finishes change test to company name##
}
)
[void]$Form.ShowDialog()
(New-Object System.Net.WebClient).DownloadFile("https://download.mozilla.org/?product=firefox-latest-ssl...", "$env:temp\FirefoxSetup.exe")
Start-Process -FilePath "$env:temp\FirefoxSetup.exe" -ArgumentList '/S' -Wait
or
$url = "https://download.mozilla.org/?product=firefox-latest..."
$file = "FirefoxSetup.exe"
Invoke-WebRequest -Uri $url -OutFile $file
Start-Process -FilePath $file -ArgumentList '/S'
resetting your password when you're logged in but forgot password
Run powershell as admin