Posts

Windows - Sent e-mail using vbs

Sometimes I need to test my mail server. To do this I use this script below, just change to your address and server. Just copy and paste in a .vbs file. Set objEmail = CreateObject("CDO.Message") objEmail.From = " youremail@mail.com " objEmail.Subject = " Subject " objEmail.To = " youremail@mail.com " objEmail.Textbody = Body objEmail.Configuration.Fields.Item _   (" http://schemas.microsoft.com/cdo/configuration/sendusing ") = 2 objEmail.Configuration.Fields.Item _   (" http://schemas.microsoft.com/cdo/configuration/smtpserver ") = _ " mailserver.yourdomain.com " objEmail.Configuration.Fields.Item _   (" http://schemas.microsoft.com/cdo/configuration/smtpserverport ") = 25 objEmail.Configuration.Fields.Update objEmail.Configuration.Fields.Update objEmail.Send

Windows - How to show print document name in event viewer

By default Windows Server does not save documents name in event viewer. To change this just add the key below. [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows NT\Printers]  "ShowJobTitleInEventLogs"=dword:00000001 You don't have to restart the service to see your documents name.

OpenEdge (Progress) - List BI Writes an Reads

Sometimes you have to know who is making your BI bigger than expected. With the select below you can do that: SELECT          database() as 'Database',          u."_UserIO-Name" as 'User',          u."_UserIO-BIRead" as 'Reads',          u."_UserIO-BiWrite" as 'Writess'   FROM PUB."_UserIO" u   where u."_UserIO-BiRead" > 0 or u."_UserIO-BiWrite" > 0   order by u."_UserIO-BiWrite" desc

Impacket-master - psexec for linux

I have an application that need to execute remote commands on Windows and linux. This app run in a CentOS server. It is easy to execute a remote on linux, but on Windows I had to search a good solution and I had find Impacket-master. To use this solution you have to follow this steps: Install python in your linux; Download this libraries; argparse-master - https://pypi.python.org/pypi/argparse   pyasn1 - https://pypi.python.org/pypi/pyasn1   pycrypto-2.6.1 - https://pypi.python.org/pypi/pycrypto Install Libraries; Unpack files: tar -vzxf pyasn1-0.1.9.tar.gz Install: python setup.py install  After this, install Ipacket-Master: python setup.py install You can find psexec.py in examples folder: impacket-master/examples These is a command line with an example: python psexec.py domain/user:password@server 'cmd /c "dir /s c:\"'

Windows - Open exe, bat and all other program files from your intranet

It is common to have a lot of shortcuts to our systems on the intranet. It is easy to publish web applications but it is hard to put together all desktops programs. To make easy this task you have to to 3 steps: 1 - Create a batch file and put this in a share which everybody has access; 2 - Add in your Windows desktops a registry file, this file will contain an URI definition that will make possible the workstations understand what to do with the instruction from html link. 3 - Create a link in your intranet, or create a HTML file with a link to test. 1 - Batch file: create a batch file like this example. for /F "tokens=2 delims=: " %%a in ("%1%") do ( rem this step will get the program from instruction set startProgram=%%a ) rem this step will replace / for \ set htmlProgram=%startProgram:/=\% start %startProgram% 2 - Windows registry: Create a .reg file with a text like this example. Windows Registry Editor Version 5.00 [HKEY...

Firebird - List last command from each connection

You can do this with this select: select  MON$SERVER_PID as PID, a.MON$REMOTE_ADDRESS as IP, a.MON$REMOTE_PROCESS as Program, MON$PAGE_READS as DiskRead, MON$PAGE_WRITES as DiskWriters, s.MON$SQL_TEXT as SQL from MON$ATTACHMENTS a, MON$IO_STATS i, MON$STATEMENTS s where  a.MON$STAT_ID = i.MON$STAT_ID  and a.MON$ATTACHMENT_ID = s.MON$ATTACHMENT_ID order by   MON$PAGE_READS desc

Active directory - Import data from CSV file

You can use the powershell script below to import data from a CSV file to your Active Directory. This example importa the department property from file. Import-Module ActiveDirectory $users = import-csv c:\temp\data.csv foreach ( $user in $ users ){ Set-ADUser $ user . samaccountname -Department $ user . department } CSV file example samaccountname,department username1,departament1