I have tried using NetShutDown in the WHDLStartup script, but it never returns after being called - to me it seems the process gets locked.
NetShutdown requires that there are no active network connections. The network stack will automatically send Ctrl-C to all processes doing TCP/IP, but some might not respond to this signal. For example SMBFS does not quit if there are some files open on a network share.