WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Network Related

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

NetSetServerInfo

This UDF uses a Windows API function to update the "MachineComment" field associatioed with the ComputerName field.
#DefineFunction SetMachineComment(comment)
   dll=StrCat(DirWindows(1),"netapi32.dll") 

   ;convert to Unicode
   bb=BinaryAlloc( (StrLen(comment)*2) +2)
   BinaryPokeStr(bb,0,comment)
   BinaryConvert(bb,0,3,0,0)

   lpbb=BinaryAlloc(4)
   BinaryPoke4(lpbb,0,IntControl(42,bb,0,0,0))

   DllCall(dll, long:"NetServerSetInfo", lpnull, long:1005, lpbinary:lpbb, lpnull) ;
   x=DllLastError()
   BinaryFree(bb)
   BinaryFree(lpbb)
   Return(1)
#EndFunction




flag=SetMachineComment("FlimFlam")

AddExtender("WWWNT34i.DLL")
info=wntServerInfo( "", 4)
Message("ServerComment",info)


Article ID:   W16253
File Created: 2004:03:30:15:43:34
Last Updated: 2004:03:30:15:43:34