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

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

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

Get User and Memory Info


Dumps all the information below into a flat file and names the file as the current example:

machine name (dibert.txt)

adds registry permissions - folder permissions

Current Date:
Current User ID: 
User Full Name: 
Get users email: 
Computer Name: 
Application Installed: manually add version of media
Automatically adds machine name to group_packages
I hope that this will come in handy for someone else again thanks to.
;***************************************************************************
;**Created by Dale Lee 
;**This script will retrieve the following information  " HD-Size / HD-Free "  
;**Also will retrieve the amount of memory installed
;***************************************************************************
;Start block for gathering users Full Name,Logon ID,Email Address
curruser = Environment("username")
#DefineFunction GetUserNameEx(type)
  dll=Strcat(DirWindows(1),"secur32.dll")
  bbsize=1000
  bb=BinaryAlloc(bbsize)
  BinaryEODSet(bb,bbsize)
  bbs=BinaryAlloc(4)
  BinaryPoke4(bbs,0,bbsize)
  DllCall(dll,long:"GetUserNameExA",long:type,lpbinary:bb,lpbinary:bbs)
  retval=BinaryPeekStr(bb,0,bbsize)
  BinaryFree(bb)
  BinaryFree(bbs)
  Return(retval)
#EndFunction


;Gets current users Login ID,Full Name,Email Address
for xx=3 to 3
   uname=GetUserNameEx(xx)
  ; Message("Name code type = %xx%",uname)
next

for xx=4 to 4
   email=GetUserNameEx(xx)
  ; Message("Name code type = %xx%",email)


;***************************************************************************
;** Start block for adding user to PK_Metro_Search_Drive_Mapping_v1.4
;***************************************************************************
CPTN = Environment("computername")
RunHide("net.exe", "group  pk_dale_test %CPTN%$ /add /domain")
;***************************************************************************
;** End block for adding user to PK_Metro_Search_Drive_Mapping_v1.4
;***************************************************************************
;This section get the current date and time
date=Timedate( )
;This section retrieves the current user id information
curruser = Environment("username")
;This section retrieves the current workstation name
CPTN = Environment("computername")
;***************************************************************************
;**This section retrieves the current disk size and disk free parameters
;***************************************************************************
size = DiskSize("c")
size = (size/1024000000)
Cavail = DiskFree("c")
Cavail = (Cavail/1024000000)
;DirChange("c:\")
;handle = FileOpen("\\filer01\apps$\packages\Software_Inventory\Metro_Search_Drive_Mapping_v1.4\%cptn%.txt", "WRITE")


handle = FileOpen("%cptn%.txt", "WRITE")
FileWrite(handle, "********************************************************")
FileWrite(handle, "Workstation Identification Inventory Collection Database")
FileWrite(handle, "========================================================")
FileWrite(handle, "Current Date:           %date%")
FileWrite(handle, "========================================================")
FileWrite(handle, "Current User ID:        %curruser%")
FileWrite(handle, "User Full Name:         %uname%")
FileWrite(handle, "Get users email:        %email%")
FileWrite(handle, "Computer Name:          %cptn%")
FileWrite(handle, "Application Installed:  Metro Search Drive Mapping v1.4")
FileWrite(handle, "========================================================")

;***************************************************************************
;**This section retrieves amount of memory installed
;***************************************************************************
ram = WinResources(11)
ram=(ram/1024)
cnt2=ram
for dec2 = 0 to 0
Decimals(dec2)
FileWrite(handle, "MEM  Size:              %ram% MB")
;FileClose(handle)
;return
FileWrite(handle, "========================================================")

;***************************************************************************
;** Start block for administrator rights
;***************************************************************************
 runas_user = "GodlikeAdmin"
 runas_pswd = "ThusLetItBeSo$Shazam"
 runas_domain = "Dept51"
;End block for administrator permissions

;start block for installing package
 run("Metro_Search_1.4.exe","")
 timedelay (5)
;end block

AddExtender("WWWNT34I.DLL")
	RegHandle=RegOpenKey(@RegMachine,"SOFTWARE\Experian\")
	Ok=wntAccessAdd("", RegHandle, "EVERYONE",401, "Reg:Full")
	RegCloseKey(RegHandle)

	RegHandle=RegOpenKey(@RegCurrent,"Network\M")
	Ok=wntAccessAdd("", RegHandle, "EVERYONE",401, "Reg:Full")
	RegCloseKey(RegHandle)

	wntAccessAdd("", "C:\admin", "Everyone", 300, "File:Full")
	wntAccessAdd("", "C:\Windows\Metros.ini", "Everyone", 300, "File:Full")
	wntAccessAdd("", "C:\Windows\FBCuebas.ini", "Everyone", 300, "File:Full")

Article ID:   W16189
File Created: 2004:12:30:15:28:44
Last Updated: 2004:12:30:15:28:44