use IPC::Run3 qw(run3); run3 ["NET","VIEW","\\\\servername","/all"], undef, \$stdout; die $? if $?; print "Output:\n$stdout\neof\n";