Yuck. net command is nasty. Win32::NetAdmin does loads of what you want, maybe also Win32::NetResource if you are dealing with network shares etc - but for all the advanced stuff you'll need
Win32::Lanman - not available on CPAN but a google search should reveal where it's hiding.
If it's just a one off, net command is ok, I suppose!
Error: Keyboard not attached. Press F1 to continue.