Initialer Import der Synology Scripts

This commit is contained in:
root
2026-08-05 08:43:57 +02:00
commit 5e32a7c411
404 changed files with 79932 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
$clients = @("192.168.1.249")
foreach ($client in $clients) {
$sshSession = New-SSHSession -ComputerName $client -Credential $cred
Invoke-SSHCommand -SessionId $sshSession.SessionId -Command "sudo useradd -m -s /bin/bash username"
}
$groupName = "neue_gruppe"
foreach ($client in $clients) {
$sshSession = New-SSHSession -ComputerName $client -Credential $cred
Invoke-SSHCommand -SessionId $sshSession.SessionId -Command "sudo groupadd $groupName"
Invoke-SSHCommand -SessionId $sshSession.SessionId -Command "sudo usermod -aG $groupName username"
}
$password = "Passwort123!"
foreach ($client in $clients) {
$sshSession = New-SSHSession -ComputerName $client -Credential $cred
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "username", $securePassword
Invoke-SSHCommand -SessionId $sshSession.SessionId -Command "echo 'username:$password' | sudo chpasswd"
}