62 lines
2.7 KiB
Perl
62 lines
2.7 KiB
Perl
#!/bin/perl
|
|
# Für 886 ohne Autologon!
|
|
# Für 886 erfolgt reboot Montags!
|
|
|
|
use Win32::TieRegistry;
|
|
use strict;
|
|
|
|
my $host = input("Hostname","localhost");
|
|
|
|
print "\nAdministrative account:\n";
|
|
my $a_domain = input("Domain","intern");
|
|
my $a_user = input("User","administrator");
|
|
my $pw_vorga = 'bommer' if ($a_user eq 'administrator');
|
|
$pw_vorga = 'qube' if ($a_domain eq 'intern' and $a_user eq 'administrator');
|
|
$pw_vorga = "$a_user" if ($a_user ne 'administrator');
|
|
my $a_pass = input("Password","$pw_vorga");
|
|
|
|
# print "\nLogon as:\n";
|
|
# my $l_domain = input("Domain","intern");
|
|
# my $l_user = input("User","administrator");
|
|
# $pw_vorga = 'bommer' if ($l_user eq 'administrator');
|
|
# $pw_vorga = 'qube' if ($l_domain eq 'intern' and $l_user eq 'administrator');
|
|
# $pw_vorga = "$l_user" if ($l_user ne 'administrator');
|
|
# my $l_pass = input("Password","$pw_vorga");
|
|
|
|
print "\nChange 'run as ...' for at job on host $host manually\n";
|
|
|
|
print "\n\nnet use z: /delete\n";
|
|
`net use z: /delete`;
|
|
|
|
print "\n\nnet use z: \\\\$host\\c\$ /user:$a_domain\\$a_user $a_pass\n";
|
|
`net use z: \\\\$host\\c\$ /user:$a_domain\\$a_user $a_pass`;
|
|
|
|
print "\n\nxcopy shutdown.exe z:\\administrator\\oral\\\n";
|
|
`xcopy shutdown.exe z:\\administrator\\oral\\ /Y`;
|
|
|
|
print "\n\nat \\\\$host 06:00 /every:mo c:\\administrator\\oral\\shutdown.exe -r -f\n";
|
|
`at \\\\$host 06:00 /every:mo c:\\administrator\\oral\\shutdown.exe -r -f`;
|
|
|
|
my $pound = $Registry->Delimiter("/");
|
|
print "\n\n//$host/HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/WinLogon\n";
|
|
my $remoteKey = $Registry->{"//$host/HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/WinLogon"} or die "Can't read REGISTRY-Key: $^E\n";
|
|
# $Registry->{"//$host/HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/WinLogon//AutoAdminLogon"} = "0";
|
|
# $Registry->{"//$host/HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/WinLogon//DefaultUserName"} = "$l_user";
|
|
# $Registry->{"//$host/HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/WinLogon//DefaultPassword"} = "$l_pass";
|
|
# $Registry->{"//$host/HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/WinLogon//DefaultDomainName"} = "$l_domain";
|
|
# $Registry->{"//$host/HKEY_CURRENT_USER/Control Panel/Desktop//AutoEndTasks"} = "1";
|
|
# $Registry->{"//$host/HKEY_CURRENT_USER/Control Panel/Desktop//WaitToKillAppTimeout"} = "2000";
|
|
|
|
print "\n\nnet use z: /delete";
|
|
`net use z: /delete`;
|
|
|
|
|
|
sub input {
|
|
my $text = $_[0];
|
|
my $vorgabe = $_[1];
|
|
print "$text [$vorgabe]:";
|
|
my $inp = <STDIN>;
|
|
chomp $inp;
|
|
$inp = $vorgabe if $inp eq "";
|
|
return $inp;
|
|
} |