Skip to main content

Posts

Showing posts from 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.CommandLine

Batch file to start performance counters on system startup

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 :PurgeOldRec
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-ca

Runas program for touch screens

This has been updated : http://www.tonyunger.com/2012/01/runas-touch-screen-application-purpose.html Purpose: Touch screen application to run applications as a different user. It also dynamic creates button based on what it reads from a text file. I have added many changes to this application and will post a new version soon this week.

Run explorer using the Runas Command

Little batch file i made to run explorer using the runas command. It adds a registry key to the current user hive that is being used to to run explorer as a different user. @Echo Off Echo Importing Key reg add "HKCU\software\microsoft\windows\currentversion\explorer\advanced" /v SeparateProcess /t REG_DWORD /d 00000001 /f Echo Reg Key imported Echo Starting Explorer explorer /e Echo Closing Explorer reg add "HKCU\software\microsoft\windows\currentversion\explorer\advanced" /v SeparateProcess /t REG_DWORD /d 00000000 /f exit

bit for bit copy of usb flash drive free utiltiy

Found this free utility to create a bit by bit copy of a flash drive http://www.osforensics.com/tools/write-usb-images.html ImageUSB is a free utility which lets you write an image concurrently to multiple USB Flash Drives. Capable of creating exact bit-level copies of USB Flash Drive (UFDs), ImageUSB is an extremely effective tool for the mass duplication of UFDs. ImageUSB also supports writing of an ISO file byte by byte directly to an USB drive, useful in conversion of bootable CD/DVD iso to a bootable USB drive. ImageUSB can also be used to install OSFClone to a USB Drive for use with PassMark OSForensics™. Download Link http://www.osforensics.com/downloads/imageusb.zip Download link if site is down http://dl.dropbox.com/u/24077962/imageusb.zip

Managing AD objects

3 Ways to Move AD Objects 1. Open ADUC and drag and drop object 2. Context Menu - right click 3. DSMove - Command line Example To move user tunger from the users container to the sales users ou under corp users ou here is the command dsmove "cn=tunger,cn=users,dc=tonyunger,dc=com" -newparent "ou=sales users,ou=corp users,dc=tonyunger,dc=com" 3 Ways to Delete Objects 1. Highlight object and hit delete button on keyboard 2. context Menu - right click and choose delete 3. DSRM - command line Delete User: DSRM "cn=tunger,cn=users,dc=tonyunger,dc=com" Delete OU: Remove an ou named sales users and all objects under the ou DSRM -subtree - nopromp -c "ou=sales users,ou=corp users,dc=tonyunger,dc=com" To remove all objects under an OU named sales, but leave the ou intact DSRM - subtree -exclude -noprompt -c "ou=sales users,ou=corp users,dc=tonyunger,dc=com" Add a user dsadd user "cn=tunger,cn=users,dc=tonyunger,dc=com" -fn Tony -ln Ung

Shadow Groups

http://trycatch.be/blogs/roggenk/archive/2007/07/18/active-directory-domain-services-fine-grained-password-policies.aspx A shadow group is a global security group that is logically mapped to an OU to enforce a fine-grained password policy. You add users of the OU as members of the newly created shadow group and then apply the fine-grained password policy to this shadow group. You can create additional shadow groups for other OUs as needed More information: http://technet.microsoft.com/en-us/library/cc770394(WS.10).aspx
From http://www.symantec.com/connect/articles/readyfsmo-roles-active-directory-windows-2008-server Flexibility Schema Operations Master FSOP 1. Forest Roles Schema Master - As name suggests, the changes that are made while creation of any object in AD or changes in attributes will be made by single domain controller and then it will be replicated to another domain controllers that are present in your environment. There is no corruption of AD schema if all the domain controllers try to make changes. This is one of the very important roles in FSMO roles infrastructure. Domain Naming Master - This role is not used very often, only when you add/remove any domain controllers. This role ensures that there is a unique name of domain controllers in environment. 2. Domain Roles Infrastructure Master - This role checks domain for changes to any objects. If any changes are found then it will replicate to another domain controller. RID Master - This role is responsible for making sure each securit

Lan Wan Speed Test Iperf

Iperf is a tool i use to determine tcp or udf performance on a network. The following commands are to be ran on the client(machine connecting from) and servers(Machine connecting to) Client: iperf.exe -c 192.168.1.51 Server: iperf.exe -s Iperf is opensource. Download links Linux http://code.google.com/p/iperf/ http://sourceforge.net/projects/iperf/ Windows https://nocweboldcst.ucf.edu/files/iperf.exe - old http://www.mayoxide.com/iperf/ - newer build fork.

using logman to start monitoring counters in perfmon

Create a batch file logman start test create a schedule task to run that batch file at system start up http://technet.microsoft.com/en-us/library/cc755366(WS.10).aspx To start daily collections with sample intervals, account names and passwords, type: Logman start daily_perf_log -s \\%computer_name% -u admin "adminpassword" To start manual data collections, type: Logman start daily_perf_log To stop data collections, type: Logman stop daily_perf_log To delete data collections, type: Logman delete daily_perf_log To display the status of collection queries, type the following commands:

Performance log

http://technet.microsoft.com/en-us/library/cc737657(WS.10).aspx Monitoring performance from the command line Updated: January 21, 2005 Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2 Monitoring performance from the command line In addition to using the Performance graphical interface, you can use the following command line utilities: Logman manages and schedules performance counter and event trace log collections on local and remote systems. Perfmon allows you to open a Performance console configured with the System Monitor ActiveX control and Performance Logs and Alerts Service. Relog extracts performance counters from performance counter logs into other formats, such as text file (tab delimited), text file (comma delimited), binary-BIN, or SQL. Tracerpt processes event trace logs or real-time data from instrumented event trace providers and allows you to generate trace analysis reports and CSV (comma-delimited) files

ssh snapshot netapp

Little script i pieced together to create a snapshot via batch file Requirement plink just google for putty ssh @echo off echo Note: echo echo This batch file will create a snapshot of volumes echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo º º echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ echo º Created by Tony Unger 6/10/2011 º echo º V1.0 Initial Release º echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ echo Enter Username: set /p UserName= echo Enter Password: set /p PassWord= rem ************************* boot_udfdax64db ****************************************************************************************** echo Creating boot_udfdax64db REM boot_udfdax64db Snapshot rem creates command to run echo snap create boot_udfdax64db WedsSnapshot%date:~4,2%%date:~7,2%%date:~10,4%> commands\boot_udfdax64db.txt rem use plink to ssh tunnel to netapp box and force snapshot "exe\plink.exe" -ssh -pw %PassW