Probably M:\Inventory does not exist or you cannot create a file in it. Or the ".txt" file does exist and you don't have permissions to write to it.

Try the following, it will display an error message if there is a problem:
Code:
$nul= ReDirectOutput ("M:\Inventory\"+@WKSTA+".txt",1)
If @ERROR "Redirect error ["+@ERROR+"] "+@SERROR+@CRLF EndIf