Initial commit
This commit is contained in:
31
scripts/ssh/fix-winrm.sh
Executable file
31
scripts/ssh/fix-winrm.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
HOST="${HOST:-192.168.88.108}"
|
||||
USER_NAME="${USER_NAME:-Admin}"
|
||||
PASS="${PASS:-P@ssw0rd!}"
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
SCRIPT="$HERE/../powershell/fix-winrm.ps1"
|
||||
LOG_DIR="$HERE/../../logs"
|
||||
STAMP="$(date +%Y%m%d-%H%M%S)"
|
||||
LOG="$LOG_DIR/fix-winrm-${HOST}-${STAMP}.log"
|
||||
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
SSH_OPTS=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10)
|
||||
|
||||
echo "[*] Fixing remaining WinRM configuration issues on $USER_NAME@$HOST"
|
||||
echo "[*] Uploading fix script..."
|
||||
|
||||
sshpass -p "$PASS" scp "${SSH_OPTS[@]}" "$SCRIPT" "$USER_NAME@$HOST:C:/Users/$USER_NAME/fix-winrm.ps1" >/dev/null
|
||||
|
||||
echo "[*] Running WinRM configuration fixes, log -> $LOG"
|
||||
echo "=================================================================="
|
||||
|
||||
sshpass -p "$PASS" ssh "${SSH_OPTS[@]}" "$USER_NAME@$HOST" \
|
||||
"powershell -NoProfile -ExecutionPolicy Bypass -File C:/Users/$USER_NAME/fix-winrm.ps1" \
|
||||
2>&1 | tee "$LOG"
|
||||
|
||||
echo "=================================================================="
|
||||
echo "[*] WinRM fixes completed. Log saved: $LOG"
|
||||
Reference in New Issue
Block a user