Leser: 4
6 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/perl -w use strict; use warnings; use File::Copy; if (-e '\\server\c$\log\logfile.log') { print "datei vorhanden\n"; copy('\\server\c$\log\logfile.log','C:\TEMP') or die("Copy failed: $!"); } else { print "datei nicht vorhanden\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl -w use strict; use warnings; use File::Copy; use Win32::NetResource; my $RemoteShare = { 'Type'=> RESOURCETYPE_DISK, 'Usage' => RESOURCEUSAGE_CONNECTABLE, 'LocalName' => "Y:", 'RemoteName' => "\\servername\c$" }; my $UserName = ""; my $Password = ""; my $Connection = 1; my $ErrorCode = ""; Win32::NetResource::AddConnection($RemoteShare,$Password,$UserName,$Connection) or print "unable to add network\n"; Win32::NetResource::GetError( $ErrorCode ); print "Error code is $ErrorCode";
'RemoteName' => "\\servername\c$"
'RemoteName' => '\\servername\c$'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use Win32::NetResource; my $RemoteShare = { 'Scope' => RESOURCE_CONNECTED, 'Type'=> RESOURCETYPE_DISK, 'DisplayType' => RESOURCEDISPLAYTYPE_GENERIC, 'Usage' => RESOURCEUSAGE_CONNECTABLE, 'LocalName' => "Y:", 'RemoteName' => '\\\\server\c$', 'Comment' => "OSD A Berlin" }; my $UserName = ""; my $Password = ""; my $Connection = 0; my $ErrorCode = ""; my $Force = 0; # <---------- keine Ahnung, was da für ein Wert hinkommt. In der Doku steht leider auch nix. # # Netzwerkresource trennen # Win32::NetResource::CancelConnection($RemoteShare,$Connection,$Force) or print "unable to cancel conected network\n";
1 2 3 4 5 6 7 8 9 10 11 12
my $LocalName = "Y:"; my $RemoteShare = { 'Scope' => RESOURCE_CONNECTED, 'Type'=> RESOURCETYPE_DISK, 'DisplayType' => RESOURCEDISPLAYTYPE_GENERIC, 'Usage' => RESOURCEUSAGE_CONNECTABLE, 'LocalName' => $LocalName, 'RemoteName' => $RemoteName, }; Win32::NetResource::CancelConnection($RemoteShare,$Connection,$Force)
Win32::NetResource::CancelConnection($LocalName,$Connection,$Force)
6 Einträge, 1 Seite |