use Win32::Lanman; use Win32::Perms; use warnings; $! = $^E = 0; my %info; my ( $machine, $share_name ) = ( shift @ARGV || die ) =~ /^(\\\\.+?)\\(.*?)$/; if ( ! Win32::Lanman::NetShareGetInfo($machine, $share_name, \ %info ) ) { print "Unable to retrieve information, $! : $^E.\n"; exit( ); } print "\n\nSuccessfully retrieved information\n\n"; my ( $perms_object ) = new Win32::Perms ( ) || die "\n\n$! : $^E\n\n"; $perms_object -> Import ( $info{security_descriptor}); $perms_object -> Dump; $perms_object -> Remove ('Everyone'); # HANGS HERE FOREVER $info{security_descriptor} = $perms_object -> GetSD ( SD_RELATIVE ); if ( ! Win32::Lanman::NetShareSetInfo($machine, $share_name, \ %info ) ) { print "\n\nCompleted Successfully\n\n"; } else { print "\n\nUnable to set new Permissions\n\n"; my $status = Win32::Lanman::GetLastError(); print "\n\nError : ", Win32::FormatMessage( $status ); } $perms_object -> Close();