Wednesday, September 08, 2010

Querying HKEY_CURRENT_USER remotely

I'm not sure why MS doesn't allow this to work with their reg.exe program. On most workstations only a single user is logged in anyways...


for /f %%A IN ('type domain-list.txt') DO (
ECHO %%A >> list1.txt
reg query "\\%%A\HKU" > ".\temp.txt"
findstr /R /C:"HKEY_USERS\\S-1-5-21.*[0-9]$" ".\temp.txt" > ".\temp2.txt"
FOR /F %%Z IN ('TYPE .\temp2.txt') DO reg query "\\%%A\%%Z\Software\Unicus Medical Systems" /s /v ReportPrinterName | findstr /R /C:"ReportPrinterName" >> list1.txt
)

The above may have truncated (FYI).

Ok, what this does...
1) Sequentially pull computer names from a file (domain-list.txt)
2) Echo that computer name into our master "list" text file
3) Query the HKEY_USERS via the computer name pulled from step 1 and save to a temporary file
4) Execute a findstr that will only search for user accounts (and not CLASS keys) and save to "temp2.txt".
5) In Temp2.txt, parse and save as variable "%%Z" and execute our reg query and save to our list1.txt file.

You can replace anything with step 5 to do whatever you need (Reg Add/Delete/Query/etc.)

Wednesday, August 18, 2010

Command Line Screen Recording

http://camstudio.org/blog/camstudio-command-line-v01-released

The above will be super sweet with PSEXEC to remotely launch screen recording on an unmanaged or a workstation that you cannot be present for.

Friday, June 18, 2010

AppleTV Harddrive Hack

Everyone knows how to upgrade your AppleTV hard drive with a bigger IDE drive, but with a dremel you can upgrade it to a SATA drive. Follow the same instructions for adding the AppleTV software to a 2.5" SATA drive. Then get started on adding the 500GB drive to the AppleTV.

1) AppleTV and new 500GB SATA 2.5" HDD

2) Remove the bottom of the AppleTV

3) Remove the original AppleTV hard drive

4) You will need to poke a hole in the IDE cable on the AppeTV as it's key'ed. The OEM 2.5" IDE to SATA converter does not have the pin missing for the key'ed hole.

5) It's very important to orientate the cable properly on the IDE to SATA converter as laptop IDE contains additional pins for power. If you orientate it wrong you can damage the hard drive or the converter.

6) The AppleTV with SATA converter and 500GB HDD.

7) Before modding the AppleTV I connected it to the TV to verify functionality
Success!

8) Modification time. This is the space you have to work with.

9) Because space is such so tight we need to chop off one of mounting posts and a part of the shield/baffle.

10) We're so down to the wire with space we need to clip off the top of the IDE cable.

11) Test fitting
It Fits!

12) Dremel off the mounting stand (top right corner)

Put it back together and you're all done!

Tuesday, April 20, 2010

Pushing View Controllers

Pushing View Controllers is ridiculously simple. You can do it in 2 lines of code, but with 2 dependancies.
1) Create a navigationController object in the AppDelegate file (.h and .m).
2) You must make a UIViewController object and add its header to the View Controller header you want to push *from*
3)

PhotoListView *secondPage = [[PhotoListView alloc] initWithNibName:@"PhotoListView" bundle:[NSBundle mainBundle]];

[[self navigationController] pushViewController:secondPage animated:YES];



4) Done.

Getting back into Objective-C Programming

Thanks to Stanfords C193P course.
Some things I've found along the way:
FYI, because of the black text you'll need to copy/paste to see the entire codeblock
Convert a NSArray to C array:

NSArray *pointsArray = [PolyShape pointsForPolygonInRect:rect numberOfSides:[polygon numberOfSides]];

//count the number of objects in the array and set a matching integer

int i;

i=[pointsArray count];

//setup our C array to match the number of objects in the pointsArray...

CGPoint thePointArray[i];

//for each object in the pointsArray, set a CGPoint value, add it to the C-Array (thePointArray) in it's matching index

for (id object in pointsArray) {

CGPoint thePoint = [object CGPointValue];

i--;

thePointArray[i] = CGPointMake(thePoint.x, thePoint.y);

}