Aloha せかい - Script
type: channel
link: https://klee.ist/index.php/tag/Script/
items: Powershell script to remove MSWord password protection
items: Scripts collection
items: Reinstall debian/ubuntu/centos with script

Powershell script to remove MSWord password protection
type: item
date: 2025-07-10T15:53:02+08:00
description: Please note that this script can only remove the password-protected editing restriction.#Requires -Version 5.1 <# .SYNOPSIS A script to process a Word document, remove document protection, and restore its original file format. .DESCRIPTION This script performs a three-stage process on a Word document provided via command-line. It correctly handles both relative and absolute file paths. Stage 1: Converts legacy '.doc' files to the modern '.docx' format if necessary. Stage 2: Treats the .docx file as a ZIP archive to modify its internal 'word/settings.xml'. It removes the entire '<w:documentProtection>...</w:documentProtection>' XML node from this file. Stage 3: If the original file was a '.doc', it converts the modified '.docx' file back to the '.doc' format, preserving the original filename. IMPORTANT: - You must have Microsoft Word installed for the conversion steps. - The .NET Framework 4.5 or higher is required for the ZIP manipulation functions. .PARAMETER InputFilePath The full or relative path to the Word document you want to process. .EXAMPLE # Using a full path .\Process-WordDoc.ps1 -InputFilePath "C:\Shared\ProtectedReport.docx" .EXAMPLE # Using a relative path from the script's location .\Process-WordDoc.ps1 -InputFilePath "..\Reports\LegacyProtected.doc" #> # --- PARAMETERS --- param ( [Parameter(Mandatory = $true, HelpMessage = "Please provide the full or relative path to the Word document.")] [ValidateScript({ if (-not (Test-Path $_ -PathType Leaf)) { throw "File not found at path: $_" } return $true })] [string]$InputFilePath ) # --- SCRIPT INITIALIZATION --- # Convert the provided path (which could be relative) to a fully qualified absolute path. # This is crucial for ensuring the Word COM object and other file operations work reliably. $InputFilePath = (Resolve-Path -LiteralPath $InputFilePath).ProviderPath Write-Host "Processing absolute file path: $InputFilePath" # This flag tracks if the original file was a .doc format. $wasOriginallyDoc = $false …

Scripts collection
type: item
date: 2019-03-06T11:29:00+08:00
description: Modify Windows RDS port.@echo off color f0 echo Modify the port for RDS(support Windows 2003 2008 2008R2 2012 2012R2 7 8 10 ) echo Add firewall rules automatically echo %date% %time% echo ARK set /p c= Input a new port: if "%c%"=="" goto end goto edit :edit netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%" netsh advfirewall firewall add rule name="Remote PortNumber" dir=in action=allow protocol=TCP localport="%c%" reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v "PortNumber" /t REG_DWORD /d "%c%" /f reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber" /t REG_DWORD /d "%c%" /f echo Modified echo Press any key to restart Windows pause shutdown /r /t 0 exit :end echo Failed pauseInstall serverSpeeder with version choices#!/bin/bash function Welcome() { clear echo -n " Local Time : " && date "+%F [%T] "; echo " ======================================================"; echo " | serverSpeeder |"; echo " | for Linux |"; echo " |----------------------------------------------------|"; echo " | -- By .Vicer |"; echo " ======================================================"; echo ""; rootness; mkdir -p /tmp cd /tmp } function rootness() { if $EUID -ne 0 ; then echo "Error:This script must be run as root!" 1>&2 exit 1 fi } function pause() { read -n 1 -p "Press Enter to Continue..." INP if [ "$INP" != '' ] ; then echo -ne '\b \n' echo ""; fi } function Check() { echo 'Preparatory work...' apt-get >/dev/null 2>&1 [ $? -le '1' ] && apt-get -y -qq install grep unzip ethtool >/dev/null 2>&1 yum >/dev/null 2>&1 [ $? -le '1' ] && yum -y -q install which sed grep awk unzip ethtool >/dev/null 2>&1 [ -z "$KNA" ] && [ -f /etc/redhat-release ] && KNA=$(awk '{print $1}' /etc/redhat-release) [ -z "$KNA" ] && [ -f /etc/os-release ] && KNA=$(awk -F'[= "]' '/PRETTY_NAME/{print $3}' /etc/os-release) [ -z "$KNA" ] && [ -f /…

Reinstall debian/ubuntu/centos with script
type: item
date: 2017-12-12T21:35:00+08:00
description: Here comes a simple script that reinstalls your existing system with a fresh clean system.Copyright: Vicercode:#!/bin/bash ## It can reinstall Debian, Ubuntu, CentOS system with network. ## Suitable for using by GRUB. ## Default root password: Vicer ## Blog: https://moeclub.org ## Written By Vicer export tmpVER='' export tmpDIST='' export tmpURL='' export tmpWORD='' export tmpMirror='' export tmpSSL='' export tmpINS='' export tmpFW='' export ipAddr='' export ipMask='' export ipGate='' export linuxdists='' export ddMode='0' export setNet='0' export setRDP='0' export isMirror='0' export FindDists='0' export loaderMode='0' export SpikCheckDIST='0' export UNKNOWHW='0' export UNVER='6.4' while $# -ge 1 ; do case $1 in -v|--ver) shift tmpVER="$1" shift ;; -d|--debian) shift linuxdists='debian' tmpDIST="$1" shift ;; -u|--ubuntu) shift linuxdists='ubuntu' tmpDIST="$1" shift ;; -c|--centos) shift linuxdists='centos' tmpDIST="$1" shift ;; -dd|--image) shift ddMode='1' tmpURL="$1" shift ;; -p|--password) shift tmpWORD="$1" shift ;; -i|--interface) shift interface="$1" shift ;; --ip-addr) shift ipAddr="$1" shift ;; --ip-mask) shift ipMask="$1" shift ;; --ip-gate) shift ipGate="$1" shift ;; --loader) shift loaderMode='1' ;; --prefer) shift tmpPrefer="$1" shift ;; -a|--auto) shift tmpINS='auto' ;; -m|--manual) shift tmpINS='manual' ;; -apt|-yum|--mirror) shift isMirror='1' tmpMirror="$1" shift ;; -rdp) shift setRDP='1' WinRemote="$1" shift ;; -ssl) shift tmpSSL="$1" shift ;; --firmware) shift tmpFW='1' ;; *) if "$1" != 'error' ; then echo -ne "\nInvaild option: '$1'\n\n"; fi echo -ne " Usage:\n\tbash DebianNET.sh\t-d/--debian [\033[33m\033[04mdists-name\033[0m]\n\t\t\t\t-u/--ubuntu [\033[04mdists-name\033[0m]\n\t\t\t\t-c/--centos [\033[33m\033[04mdists-verison\033[0m]\n\t\t\t\t-v/--ver [32/\033[33m\033[04mi386\033[0m|64/amd64]\n\t\t\t\t--ip-addr/--ip-gate/--ip-mask\n\t\t\t\t-apt/-yum/--mirror\n\t\t\t\t-dd/--image\n\t\t\t\t-a/--auto\n\t\t\t\t-m/--manual\n" exit 1; ;; esa…