Excel custom number format
[<1000000]##0.00," KB";[<1000000000]##0.00,," MB";##0.00,,," GB"
$taskName = "Restart-Service" | |
$serviceName = "ServiceName" # Specify the service name | |
$scriptPath = "C:\Dir_Name\Restart-Service.ps1" | |
$logFile = "C:\Dir_Name\Service_Restart_log.txt" | |
$dirPath = "C:\Dir_Name" | |
$taskDescription = "Restarts $serviceName daily at 12:00 AM and logs to $logFile" | |
# Ensure the directory exists | |
if (-not (Test-Path $dirPath)) { | |
try { |
Excel custom number format
[<1000000]##0.00," KB";[<1000000000]##0.00,," MB";##0.00,,," GB"
#Variables and current TimeZone | |
$InternetTimeZone = Invoke-RestMethod https://ident.me/json | |
$CurrentTimeZone = Get-TimeZone | |
$timezones = [PSCustomObject]@{ #https://secure.jadeworld.com/JADETech/JADE2020/OnlineDocumentation/content/resources/encyclosys2/jadetimezone_class/ianawindowstimezonemapping.htm | |
"Etc/GMT+12" = "Dateline Standard Time" | |
"Etc/GMT+11" = "UTC-11" | |
"Pacific/Pago_Pago" = "UTC-11" | |
"Pacific/Niue" = "UTC-11" | |
"Pacific/Midway" = "UTC-11" | |
"America/Adak" = "Aleutian Standard Time" |
Type "allow pasting" first in console, then copy paste follwoing command
sendCommand(SecurityInterstitialCommandId.CMD_PROCEED);
Get-ChildItem -Recurse -File | Where-Object { $_.Extension -notin @('.doc','.docx','.pdf','.xls','.xlsx','.ppt','.pptx','.txt','.zip') } | ForEach-Object { $_ } ; Get-ChildItem -Recurse -File -Include *.zip | ForEach-Object { $zip = $_.FullName; Expand-Archive -Path $zip -DestinationPath "temp_$($_.BaseName)" -Force; Get-ChildItem -Path "temp_$($_.BaseName)" -Recurse -File | Where-Object { $_.Extension -notin @('.doc','.docx','.pdf','.xls','.xlsx','.ppt','.pptx','.txt','.zip') } ; Remove-Item "temp_$($_.BaseName)" -Recurse -Force }
robocopy \\source_server\path \\destination_server\share\path /E /COPYALL /ZB /R:5 /W:10 /J /V /ETA /TEE /LOG+:%USERPROFILE%\Desktop\robocopy_log.txt
robocopy \\source_server\path \\destination_server\share\path /E /COPY:DAT /R:5 /W:10 /J /V /ETA /TEE /LOG+:%USERPROFILE%\Desktop\robocopy_log.txt
while($true) {
Get-Process ollama | ForEach-Object {
$id = $_.Id
Write-Host "`nConnections for Ollama process $id" -ForegroundColor Green
Get-NetTCPConnection | Where-Object OwningProcess -eq $id | Select-Object LocalAddress, LocalPort, RemoteAddress, RemotePort, State
}
Start-Sleep -Seconds 2
Clear-Host
#!/bin/bash | |
CERT_FILE="localhost.pem" | |
cleanup() { | |
rm -f "$CERT_FILE" | |
exit 0 | |
} | |
trap cleanup SIGINT |
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" |