Posts

Showing posts from 2012

VBS script - List out all domain groups with users

This is a little VBS script I pieced together back in 2007. Its purpose is to connect to Active Directory and list out all domain groups and their users into a nice CSV file. If you have proper permissions on the domain just double click and it will save a csv file to c:\groupswithusers.csv. Purpose: List out all domain groups with users Note: There could be an issue listing out Domain Users group that I never fixed. 'Tony Unger Nov 2007 'if you have questions, i may or may not be able to answer them 'This script returns all the groups with their members in this format '"Group,Display name,Account Name,Group Scope,Group Type" 'I did it that way for easy import into excel 'Tested to work on '2000 Mixed mode '2000 Native Mode '2003 Mode 'It should auto find the domain it is ran from.. if not look for strDNSDomain and fill in your information 'This was pieced together from many sources but mainly 'http://www.compu…

Good basic video on how encryption works

Raspberry PI raspi-config

Command to get into raspberry pi configuration menu o wheezy


sudo raspi-config

Runas Program

Image
I wrote up a little program that is similar to my touch screen runas program just missing the buttons. Here is the source code You will need to create a couple buttons and three text boxes. txtpassword txtusername txtpath and two buttons one for running the program and one for exit.

Requires VB.net Express 2010



Imports System.Security Imports System.ComponentModel Public Class frmMain Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load End Sub Function ConvertToSecureString(ByVal str As String) Dim password As New SecureString For Each c As Char In str.ToCharArray password.AppendChar(c) Next Return password End Function Private Sub Step1_UsernamesPasswords() Dim strUsername As String Dim strpassword As SecureString = ConvertToSecureString(txtpassword.Text) Dim strCommand As String = txtpath.Text ' MsgBox(strCommand) strUse…

Move Sql Agent Jobs to a new server

Image
1. Click on Jobs under SQL Server Agent

 2. For 2005 click on the Summary Tab, 2008 Object Explorer Details Tab under View
 3. Select the all the jobs you wish to backup listed in the object explorer details tab

4. Right Mouse click and select Script Job As -> Create To -> File

 5. Save the sql file to the new server

6. Execute the sql generated script on the new server and the jobs should populate


Credit to BrianBeall94706
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=99014

Folder Permissions Audit

The purpose of this application is i needed a way to audit NTFS folder permissions on my file server, so instead of using one of the 3rd party programs available I wrote this one.

It contains a batch file for running the executable and a text file called exclude.txt for excluding certain user names from being added to the report. Just extract the zip to a folder and run the batch file you will be asked for the path(non-UNC at the moment)after the executable is done running the report will open in notepad. In the future I will have the report export to comma delimited format.

 Note there isn't any error checking really in this application so be sure to put the correct path (ex z:\temp) When using the exclude.txt be sure to place each username on its own line. This utility only goes one level down so if you are auditing c:\temp it will only audit the top level folders within c:\temp As with any program here use at your own risk. Link to files If you would like the source code…

Block USB drive using solidcore

Image
Purpose: Disable usb flash drives from loading using solidcore.

Instructions
Step 1. Log into EPO

Step 2. Create a new rule group under Application Control



Step 3. I like to name my rules starting with a . so user rules stay at the top Step 4. Edit the created rule Step 5.  Click the Binary tab and add  Enter usbstor.sys as rule name and Name select Ban radio button and click ok Click ok
Step 6. add this newly created rule to an existing policy that is being applied

Batch delete files older then X days using forfiles : updated!

Purpose:
This batch example will search for files with the extension .txt and deletes file less then 5 days old.

Required:
----------------------------------------------------
Forfiles.exe
/p  The path to search
/s Recurse into sub-folders
/M Mask
/C command The command to execute for each file

/D - dd      Select files with a last modified date less than or
                equal to the current date minus "dd" days. (in the past)
-----------------------------------------------------
Del.exe
-----------------------------------------------------

Code:

Echo on
Forfiles /P c:\temp\ /S /M *.txt /C "cmd /c del @path" /D -5 If you have a space in the path the only way i found forfiles.exe to work is the following example

if a file is older then 30 days in e:\example space then delete
forfiles -p "e:\example space" -m *.* -s -d -30 -c "cmd /C del @FILE"




Disable Solidcore

Running solidcore you may run into a problem where you have to disable it with out using epo or the local CLI
Here are the steps.
Step 1. Boot computer into Safe Mode(Press F5 before windows boot screen) Step 2. Open Registry (Start->Run->regedit) Step 3. Navigate to: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\swin\Parameters] Step 4. Double-click DWORD RTEMode and change value to 0 Double-click DWORD RTEModeOnReboot and change value to 0

Reboot the computer and the agent should now be disabled.
Note:
Doing this will send out alerts to the central server.

Excel document for pinging list of computers VBA

Image
Here is an excel document I created that will ping a list of nodes in column A and give results in column B. There are much better tools that can be used such as angry ip scanner http://www.angryip.org/w/Home. I just wrote this as an example


Requirements:
Tested with Office 2010

Download:
<a href="https://www.dropbox.com/s/96y554q8sf49wf4/ip%20pinger.xlsm?dl=0</a>

Howto: Two different subnets same physical LAN how to get them to talk without a gateway

Have you ever ran into a problem where you had two windows boxes that were on different sub nets on the same physical LAN and you needed to establish temporarily communication?
Say you have these two computers with the following ip addresses.
Computer 1 172.16.1.2 
Computer 2 192.168.100.1


So what we are going to do is tell each computer that in order to get to the other computer they have to go out their local interface.
Open a command prompt and run each of the following commands on the respective computer.
Computer 1 route add 192.168.100.1 MASK 255.255.255.255 172.16.1.2
Computer 2 route add  172.16.1.2  MASK 255.255.255.255 192.168.100.1

This now should allow for communication to occur.

I wrote a batch file to help with adding the route command


@echo off
echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Echo Created By Tony Unger
Echo **********************************************************************
echo Note:

echo Setup Routing Table
Echo Enter IP add…
ATTR attributes for Solidcore 5

These are not listed in the documentation I had to get this information from development.


Attr command can be used to configured the required files to behave corresponding the solidifier.

-a  Always authorized attribute
     This attribute allows the user to configure a supported file as always authorized to execute.
      File configured under this attribute will be allowed to execute whether solidified or not.


-b  Bypassed from memory control attribute
      This attribute allows user to configure a process to run bypassed from MP-mangking and MP-decoying.
      This is one of the memory protection technique provided by solidifier but it is disabled by default.


-c  Bypassed from Critical Address Space Protection attribute
     Critical Address Space Protection is the latest and most effective memory protection technique provided by Solidifier. It is enabled by default.


     -c attribute configures a process to run bypassed from MP-CASP.


-d  Bypassed f…
Image
Runas Touch Screen Application
















Purpose:
One of the problems I had at work was the ability to run an application as a different user on a touch screen computer. So I wrote an application that dynamically creates buttons based on what it reads from a text file called paths.txt. This program does support arguments and should be able to figure out how to break up the path to find them.

To install just extract the application and paths.txt to a folder and runas away.

Requirements:
.net 4 framework
osk.exe in the usual place if you want to use the onscreen keyboard

TODO:
Add some more error checking with reading the text file
Clean code
Maybe allow this to work with domain user if someone wants.



Paths.txt 

name,path
------------------------------------------------------------------------------
Add\Remove Programs,rundll32.exe shell32.dll,Control_RunDLL Appwiz.cpl
Command Prompt,C:\Windows\System32\cmd.exe
Datetime,rundll32.exe shell32.dll,Control_RunDLL TimeDate.cpl
Display Properties,rundll32.…