Posts

Showing posts from November, 2011
This is an example of a vb.net 2010 console application i wrote to send emails off an open relay.


Imports System.Net.Mail

Module Module1

    Sub Main()
        'Arguments
        Dim inputArgumentEmailto As String = "/emailto="
        Dim inputArgumentSubject As String = "/subject="
        Dim inputArgumentSMTP As String = "/smtp="
        Dim inputArgumentBody As String = "/body="
        Dim inputArgumentEmailFrom As String = "/emailfrom="
        Dim inputArgumentQuestion As String = "/?"

        '  Dim inputQuestion As String = ""
        Dim inputEmailto As String = ""
        Dim inputSubject As String = ""
        Dim inputSMTP As String = ""
        Dim inputBody As String = ""
        Dim inputEmailFrom As String = ""

        Dim strTestArgs As Boolean



        For Each s As String In My.Application.CommandLineArgs

            If s.ToLower.StartsWi…

Batch file to start performance counters on system startup

Image
Requirements:
Create folder on the c: drive
c:\perflogs\
Download
7-Zip
http://www.7-zip.org/download.html
copy 7za.exe to c:\perflogs
open perfmon and create the counters you wish to use
Add each counter name you created to the batch code under
:logmans in this format logman start countername




Create a schedule task that will run the created batch file at system startup
On reboot all csv files will be added to a zip file called performance{date}.zip
Then performance counters will be started.

REM Tony Unger
REM 8/26/2011
REM Initial Release 1.0
REM This batch file that compress all file in the c:\perflog directory to
performance%date:~4,2%%date:~7,2%%date:~10,4%.zip then purges all the old entries
rem then it starts the performance log again
7za.exe a -tzip c:\perflogs\performance%date:~4,2%%date:~7,2%%date:~10,4%.zip c:\perflogs\*.csv
if exist c:\perflogs\performance%date:~4,2%%date:~7,2%%date:~10,4%.zip goto PurgeOldRecords
:Exit
exit
:PurgeOldRecords
del …
Windows API Calls Programs

Found from http://www.angelfire.com/poetry/vbpoet/myvb.htm


Convert the letters in a string to all Lower case letters
Private Declare Function CharLower Lib "user32.dll" Alias "CharLowerA" (ByVal lpsz As String) As String
Private Sub Form_Load()
' Convert the string "This is a TEST for LOWER Case Convertion!" into lower-case.
Dim t As String  ' target string
t = CharLower("This is a TEST for LOWER Case Convertion!")  ' Convert to lower-case
MsgBox t
End
End Sub


Convert the letters in a string to all Upper case letters
Private Declare Function CharUpper Lib "user32.dll" Alias "CharUpperA" (ByVal lpsz As String) As String
Private Sub Form_Load()
' Convert the string "This is a test for upper Case Convertion!" into upper-case.
Dim t As String  ' target string
t = CharUpper("This is a test for upper Case Convertion!")  ' Convert to upper-case
MsgBox t
End
End Sub