From the Directory

by stephen mcgroarty 6/15/2010 8:54:57 PM

Sometimes it is easy to actually come up with content, other times not so much. This is one that it took a bit of finding but it was something I got stuck on.

How do you get the Active Directory Schema information without remote desktop/console access. Now there are other ways to do this, but i was looking for a simple console scripted method. NTDSUTIL has the power to do this via a simple script

First an example

C:\Documents and Settings\smcgroarty>ntdsutil
ntdsutil:

Notice that the command prompt, it will continue to change for each section that you are in

ntdsutil: domain management
domain management:
domain management: connection
server connections: connect to server DCSRV1
Binding to DCSRV1…
Connected to DCSRV1using credentials of locally logged in user.
server connections: quit
domain management: select operation target
select operation target: list roles for connected server
Server "DCSRV1" knows about 5 roles
Schema - CN=NTDS Settings,CN=DCSRV2,CN=Servers,CN=Sites,CN=Configuration,DC=velcrohurts,DC=com Domain - CN=NTDS Settings,CN=DCSRV2,CN=Servers,CN=Sites,CN=Configuration,DC=velcrohurts,DC=com
PDC - CN=NTDS Settings,CN=DCSRV2,CN=Servers,CN=Sites,CN=Configuration,DC=velcrohurts,DC=com
RID - CN=NTDS Settings,CN=DCSRV2,CN=Servers,CN=Sites,CN=Configuration,DC=velcrohurts,DC=com
Infrastructure - CN=NTDS Settings,CN=DCSRV2,CN=Servers,CN=Sites,CN=Configuration,DC=velcrohurts,DC=com
select operation target:

After you get the values, you need to type quit, for each step.
select operation target: quit
domain management: quit
nntdsutil: quit
C:\Documents and Settings\smcgroarty>

Now to put this in a simple batch file:
ntdsutil domain management connection connect to server DCSRV1 quit select operation target “list roles for connected server” quit quit quit

Thanks the quick and dirty of it, hope someone finds this useful

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Weekly Tip

Sometimes it can be handy

by Stephen McGroarty 6/8/2010 7:01:00 AM

Going to try something different here, I notice that I am not paying a lot of attention to my site lately, and there isn’t a good reason not to. So for the next 30 days, until July 8th, I am going to attempt to do a post a day. I am also going to try weekends as well. The reason for this is I have a lot of things that I want to share, and I have been meaning to share from basic tech knowledge and into cars. This will also be an exercise in brushing up on my writing skills, I seem to be lacking a little bit there.

For the first post lets do a scripts to remove all the scheduled tasks on servers. We want to list all the scheduled tasks on a server, ok not a problem if you have one server you can login and view them, or you can list them remotely with

schtasks /query /s ServerName
This will return a result such as

TaskName                             Next Run Time            Status        
============================================================
FileScript1                                        23:59:00, 1/5/2010       Running        
MyTasksForStuff2                          07:00:00, 1/6/2010       Running
       

Now, you want to check the tasks on 15 servers, this gets more cumbersome and a little time consuming. So lets say you have this neat little shell script that helps you loop items so that you can one script multiple times

@echo off
 
if x==%1x goto MyServers1
if x==%2x goto MyServers2
 
for /f %%a in (%1) do call %2 %%a
goto end
 
:MyServers1
 
echo.
echo.
echo.
echo Run.bat syntax:
echo ---------------
echo.
echo Example:  run.bat list.txt program.cmd
echo.
echo 'list.txt' should contain a list of computers/IPs 
echo (one to each line) to each execute 'program.cmd'
echo.
echo The names of files are not important as long as they 
echo are specified after the run command.
echo.
echo.
echo.
echo.
 
:end

Save this as run.bat

Next we want to take our 1 line from above and put it into its own bat file with 1 change.

echo “Server Name: %1”
schtasks /query /s %1

Save that as “ViewTasks.bat”

Next we need to setup a text file that contains all the servers we want to view the scheduled task on.

Server1
Server2
Server3

Now put it all together and you will see your results

run.bat list.txt ViewTakss.bat

 

"Server Name:" Server1
TaskName                             Next Run Time            Status        
============================================================
FileScript1                                        23:59:00, 1/5/2010       Running        
MyTasksForStuff2                          07:00:00, 1/6/2010       Running
       

ServerName: Server2
TaskName                             Next Run Time            Status        
============================================================
FileScript1                                        23:59:00, 1/5/2010       Running        
MyTasksForStuff2                          07:00:00, 1/6/2010       Running
       

And you can see your tasks running. Now lets say you want to delete them. Again test with the schtasks command

schtasks /delete  /s ServerName /TN * /f

This will remove the tasks with only a complete as the last line.

So if you save this as “DeleteTasks.bat”

schtasks /delete  /s %1 /TN * /f

You can now run it as a script on all your servers with

run.bat list.txt DeleteTasks.bat

And it will remove all the scheduled tasks from your servers that you have in your list.txt

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Administration | Weekly Tip

Now with extra stuff

by Stephen McGroarty 2/22/2010 8:30:00 AM

Ok it has been a while since my last update, and I dont think it is because I am running out of stuff to talk about. Today lets just do a simple grep trick. Lets grep some stuff out of a maillog 

grep -i rejected /var/log/maillog

 that should give you about 2000 or so returns. But what if you are looking only for rejected messages from yahoo.com? Lets string some grep commands together shall we. 

 grep -r rejected /var/log/maillog | grep -r yahoo.com 

Now we are starting to narrow it down a little bit, we see only messages from yahoo.com, lets see if your email address is actually being rejected now 

grep -r rejected /var/log/maillog | grep -r yahoo.com | grep - r irocksbigtime  

Now you  you should see just your mesages 

 19:24:25 vsmtpin3 postfix/smtpd[28336]: NOQUEUE: reject: RCPT from unknown[192.168.1.101]: 504 5.5.2 <GNTDJLCVL>: Helo command rejected: need fully-qualified hostname; from=<irocksbigtime@yahoo.com> to=<XXX@XXXXXX-XXXXXXX.XXO> proto=ESMTP helo=<GNTDJLCVL>

and ta-da! you see that your sending mail server does not have a fully qualified domain name and that yahoo wont take your mail.
 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Weekly Tip

From the mouth of madness

by Stephen McGroarty 12/19/2009 3:23:00 PM

So I am using an odd assortment of things in my little world. I have Windows 7, Windows Vista, and Debian Linux on my work/home machines and strangely enough they all have web cams. With that I remembered that I have an account over at UStream.tv and that I did broadcast before, so why not do it again. 

Found the only issue is that my debian desktops dont like to broadcast, this seems to be a common issue with Linux desktop because Flash does not prompt you to allow or deny  the application. In poking around I found the application WebCam Studio for Linux and on the bottom of the "Installing on Ubuntu" page was the answer. 

1. Close all browsers

2. Go here:  http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager06.html

3.  Find "www.ustream.tv" and "cdn1.ustream.tv" and change them from "Always Ask" to "Allow" 

4. restart web browser, go to UStream.tv, login, and click broadcast. 

If your camera does work in linux you should not be able to broadcast.

If this doesnt work, make sure your webcam works in general because this is only a solution for broadcasting on websites, not making your cam work.  

I might do another post tonight if i am feeling motivated enough 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Weekly Tip

Mobile fone fun folks

by Stephen 3/21/2009 9:18:50 PM

The Samsung Omnia is the mobile phone I now have, my Motorola Q died a while ago and I tried the Blackberry Pearl but it was just wasn’t all that, the Pearl had some nice email features and was quick with that, but the general fun wasn’t there, and I did not want to take the time to figure out how to work with Java, and the price at the time was right on the Omnia, so I had to do it. Anyways, here is some things that I have done to mine to make it mine, including a screen shot or two.

I just reloaded it again cause I did some stuff to make it cry, here are the general applications that I am using to do things. First thing is to review this pageand check out some of the cool stuff he has links to.

Now the stuff that I use on my phone, this entery is more for my record keeping so I  can remember.
Keyboard - http://forum.xda-developers.com/showthread.php?p=3395347

keyboard-1         versus      keyboard-2

Hapatic Feedback – Makes the phone vibrate when you hit the shiney new keyboard Omnia device ID is 11
http://www.howardforums.com/showpost.php?p=12102979&postcount=275 

phm-registery – it says it is for window mobile 2003,  but it works really well http://www.phm.lu/Products/PocketPC/RegEdit/

Slide To Unlock – Like how you would unlock the iPhone but with a few more options
http://s2u2.ac-s2.com/

Dale Lane TwitToday – because i twitter, this is a nice app i can turn on and off when i want to view it from the today screen
http://dalelane.co.uk/page.php?id=1047

Microsoft MyPhone – This was nice, i was able to get all my contacts, appointments, pictures, and chats back without hooking the phone up to a PC
http://myphone.microsoft.com

chgfingermouse – Allows me to hit a button and switch between the D-Pad and Mouse feature on the phone, really handy for email, web browsing and the like
http://www.mysamsungepix.com/applications/utilities/chgfingermouse/

MyMobiler – This app allows me to view the screen, type from your desktop, and cut & paste.
http://www.mymobiler.com/

Advanced Configuration – Some common pre-defined registry settings all in one spot
http://www.touchxperience.com/en/advanced-configuration-tool.html

Taskbar Makeover – Add some flair to your taskbar, there are many choices here is one
http://www.modaco.com/content/i9x0-omnia-http-omnia-modaco-com/279372/taskbar-makeover/
taskbar-default   Versus  taskbar-new

 

Now time for some of the registry edits on the device

Increase Volume: 
HKEY_CURRENT_USER\ControlPanel\SoundCategories\InCall\
InitVol=4
Raises the volume while on a call

Recalibrate the Screen:
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH\
CalibrationData changed to:
519,503 177,881 182,129 847,127 849,872
These numbers will vary depending on where you look, but just find the settings that work for you

Phone Skin:
HKEY_LOCAL_MACHINE\Security\Phone\Skin\
Change “Enabled” = 1 to “Enabled” = 0

DotNet Framework 3.5:
HKEY_LOCAL_MACHINE\Software\Microsoft\.NETCompactFramework
Change 2.0.7045.00 to 0
Change 3.5.7283.00 to 1

Remove Shozu from startup
HKEY_LOCAL_MACHINE\init
Delete Launcher140

Removing Extra SIP (Keyboard Choices):
Default Windows Keyboard
HKEY_LOCAL_MACHINCE\CLSID\{42429667-ae04-11d0-a4f8-00aa00a749b9}\IsSIPInputMethod\
Change “Default” from 1 to 0

Letter Recognizer
HKEY_LOCAL_MACHINCE\CLSID\{42429690-ae04-11d0-a4f8-00aa00a749b9}\IsSIPInputMethod\
Change “Default” from 1 to 0

Block Recognizer
HKEY_LOCAL_MACHINCE\CLSID\{42429691-ae04-11d0-a4f8-00aa00a749b9}\IsSIPInputMethod\
Change “Default” from 1 to 0

Samsung Phonepad
HKEY_LOCAL_MACHINCE\CLSID\{CE176388-8E63-4549-0646-BE242E3FE78C}\IsSIPInputMethod\
Change “Default” from 1 to 0

Samsung Keyboard
HKEY_LOCAL_MACHINCE\CLSID\{CE176388-8E63-4549-0946-BE242E3FE78C}\IsSIPInputMethod\
Change “Default” from 1 to 0

Samsung Keypad
HKEY_LOCAL_MACHINCE\CLSID\{CE176388-8E63-4549-0A46-BE242E3FE78C}\IsSIPInputMethod\
Change “Default” from 1 to 0

Transcriber
HKEY_LOCAL_MACHINCE\CLSID\{F0034DD0-2AD4-11d1-9CB0-E84BE8000000}\IsSIPInputMethod\
Change “Default” from 1 to 0

 

I think that is all i have for the moment. Took me long enough to write it.

Currently rated 3.0 by 3 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Weekly Tip

Hey theme works!

by Stephen 3/18/2009 7:32:01 PM

Ok I got a new laptop, this time it is a windows based laptop, and it is shiny. Nothing overly cool about it though, it doesn't even have a Virtualization CPU so I can’t exploit VMWare on it. But so far the battery lasts for around 3 and a half hours, and it has a large hard drive, so I will more then likely dual boot it eventually, as soon as I clean it up some more. Problem with it though is all the finger prints on it. I mean seriously it has a lot of shiny surfaces that gather finger prints like mad, it might make me crazy shortly, but that is ok.

Other news of the world, I have not been studying like I should be. Just been too tired after the kids go to bed to do much of anything. I should start setting a better time line for things. I have the materials so that isn’t the issue.

Also I have been more in charge of email and found some cool tricks, tips, and settings in postfix/amavis/apache, so lets do a tip with a simple apache tweak.

Open the apache conf (/etc/httpd/conf/httpd.conf on red hat based) in your favorite editor.
look for the line
KeepAliveTimeout   15
With this line it means that each connection will time out in 15 seconds.
around that area you will also see
MaxKeepAliveRequests 100
This is how many sessions it will keep alive at a time. Now this is 100 sessions for five seconds each, it doesnt sound like much, but what if you are the 101st person who connect?
Drop that to 3 second for the KeepAliveTimeout and 100 connections and people will be happier, or you can even turn off the setting and it will be fine as well.

Another handy apache tip, if you have a heavily visited web server, turn off the reverse hostname lookups.
HostnameLookups on
Change it to off, also you need to edit how the site(s) log. By default the log format is
CustomLog logs/access_log "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\""
This should change to
CustomLog logs/access_log "%a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\""
The %h changed to a %a because %h will use the remote hostname to the log file, and %a will use the remote IP Address.
IF you really want to see the hostnames you can use logresolve.

Also, i can attach pictures again, so next update I will pull a random photo from my phone, just because I can.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Weekly Tip

Something Quick

by Stephen 7/8/2008 9:24:41 PM

So a quick one for you all. Windows Find command. It is a nice simple command and it helps find files and folders on a computer, but it can also work kind of like grep for linux. It can read the output of another command and find what you are looking for.

C:\Users\smcgroarty>netstat -ano | find  /i "135"
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       832
  TCP    [::]:135               [::]:0                 LISTENING       832

When used with the /i switch it tells it to ignore case so it will just match what is in the double quotes.

C:\Users\smcgroarty>systeminfo | find /i "Boot time"
System Boot Time:          7/8/2008, 11:44:04 PM

C:\Users\smcgroarty>systeminfo | find "Boot time"

So that is my tip of the week.

Next time I am going to try for terminal services.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Weekly Tip

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen
Hacked by Stephen McGroarty
Content © Stephen McGroarty


About the author

Stephen Mcgroarty - Avatar Stephen McGroarty

I am a Microsoft Certified Professional with Windows 2003 Server. I have a firm understanding of Linux, Windows, and everything needed for both workstation and servers.

E-mail me Send mail

Calendar

<<  September 2010  >>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

View posts in large calendar

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010