Thursday, June 28, 2012

Can you trust the man in the red underpants?

The man in the red underpants.  A great short story on how to trust ideas and beliefs.   The book starts by pointing out that you're not going to like it and it will talk about things you don't want to think about.  But, its a quick read, so why would you let that stop you? 

Click on the man to start exercising your mind.

Wednesday, June 27, 2012

Getting AD object metadata via powershell

Occasionally I receive requests in my organization to see when was a user changed, when was someone added removed from a group, etc etc.  I thought it would be nice to get away from repadmin with this and come up with something that can provide enough information, be somewhat easy to use, and not require any special rights or tools.  So I put together this script to pull metadata (either attribute changes, or multivalue changes) on computers, users, or group objects.  In the script, you provide the common name of the object and the type of object.  From here it searches the global catalog for it, pulls the metadata, cuts down the attributes and outputs it in pre-sorted columns.  From there it can be searched or further formated using typical powershell commandlets to manipulate objects.  For those that want to take this further, you can follow the example of how to pull the metadata via ldap and manipulate the XML to include the attributes you want.  Some caveats with this which you won't find in repadmin /showobjmeta is that the times are in Z time, and recording domain controller data is using the domain controller GUID.  So there are some opportunities for expansion and improvement of this script for a more tech oriented audience.




#requires -version 2

param(
 [parameter(mandatory=$true)][alias('samaccountname','cn','username','groupname')]$name,
 [parameter(mandatory=$true)][ValidateSet("Group","Computer","User")]
  [alias('object','objecttype')]$type,
 [switch][alias("members","member")]$valuemeta
)

#Set up connection to forest
$de = New-Object directoryservices.DirectoryEntry("GC://dc=contoso,dc=com")
$ds = new-object directoryservices.directorysearcher($de)

#set an appropriate search filter for each type of object
switch ($type) {
  "group" {$ds.filter = "(&(objectclass=group)(|(samaccountname=$name)(cn=$name)))" }
  "computer" { $ds.filter = "(&(objectclass=computer)(cn=$name))" }
  "user" { $ds.filter = "(&(objectclass=user)(samaccountname=$name))" }
} 

#load up metadata attribs and search
$ds.propertiestoload.add("distinguishedname") > $null
$fu = $ds.findone()
if ($fu -ne $null) {
 $de = New-Object directoryservices.DirectoryEntry("LDAP://" + $fu.properties.distinguishedname[0])
} else {
 Write-Error "Object not found in AD"
 exit 1
}
$ds.searchroot = $de
$ds.propertiestoload.add("msDS-ReplAttributeMetaData") > $null
$ds.propertiestoload.add("msDS-ReplValueMetaData") > $Null
$fu = $ds.findone()

#display the requested type of data
if ($valuemeta) {
 $xml = "<root>" + $fu.properties."msds-replvaluemetadata" + "</root>"
 $xml = [xml]$xml
 $xml.root.DS_REPL_VALUE_META_DATA | 
  Select-Object @{name="Attribute"; expression={$_.pszAttributeName}},@{name="objectDN";expression={$_.pszObjectDN}},ftimeDeleted,ftimeCreated |
  Sort-Object attribute
} else {
 $xml = "" + $fu.properties."msds-replattributemetadata" + ""
 $xml = [xml]$xml
 $xml.root.DS_REPL_ATTR_META_DATA |
  select-object @{name="Attribute";expression={$_.pszAttributeName}},@{name="ChangeTime";expression={$_.ftimeLastOriginatingChange}}|
  Sort-Object attribute
}

<#
.DESCRIPTION
 Show-ADObjMeta will show the attributes and last time written on the object.
 
.PARAMETER Name
 The name of the user/computer/group that you want to pull the metadata for.  This should be the logon
 id if it is a user, the computer name for computers, and the groupname (cn or samaccountname) for groups.

.PARAMETER ValueMeta
 Use this parameter if you want to view multivalue item metadata, like Group Member add/remove details
 
.PARAMETER Type
 Specify the type of object: User, Group, Computer
 
.EXAMPLE
 Show-ADObjMeta -type user -name myuser

 Get the metadata for attributes of myuser
 
#>

Tuesday, June 26, 2012

Bulk adding users to a domain group based on their email address

This is a quick script I threw together to help out someone with adding two thousand users to a group based on an email list. As you may notice, the format of the email and the domain DN is specified here, so if you want to use it in your environment, change the "contoso" parts to whatever is valid for your forest. This script assumes that the group that you want to add users to is a uniquely named group, as I didn't write anything to handle multiple groups in different domains with the same CN value. The script will take the email addresses from a text file (one per line) and add them to the group. If the email can't be found, or group can't be modified it will provide error details on a per email basis.




#requires -version 2

#Bulk add by email address value

param(
 [parameter(mandatory=$true)][ValidateScript({Test-path $_ -PathType Leaf})]$userlist,
 
 [parameter(mandatory=$true)][ValidateScript( {
  #This validator will check AD to see if the group exists, and it will set $script:tgtgrp to the object that
  #will be modified
  $validatesearcher = New-Object directoryservices.DirectorySearcher("GC://dc=contoso,dc=com")
  $validatesearcher.filter = "(&(objectclass=group)(cn=$_))"
  $script:tgtgrp = $validatesearcher.findone()
  return $tgtgrp
 })]$groupname
)

$script:tgtgrp = [adsi]$script:tgtgrp.path
$users = get-Content $userlist
$de = New-Object directoryservices.DirectoryEntry("GC://dc=contoso,dc=com")
$searcher = New-Object directoryservices.Directorysearcher($de)
foreach ($user in $users) {
 try {
  if ($user -notmatch "@contoso.com") {
   throw "Entry: $user  is not a valid email address"
  }
  
  $searcher.filter = "(&(objectclass=user)(proxyaddresses=SMTP:$user))"
  $userobj = $searcher.findone()
  if ($userobj -eq $null) {
   throw "Entry: $user  could not be found in active directory"
  }
  
   try {
    $script:tgtgrp.properties["member"].add($userobj.properties.distinguishedname[0]) |out-null
    $script:tgtgrp.setinfo()
   } catch {
    throw "Error occurred when trying to add member:$($userobj.properties.distinguishedname[0]) to group"
   }
  
 } catch {
  Out-Default -InputObject $_.exception
 }
}

<#
.DESCRIPTION
 Add-BulkUserByEmail will add users to a specified group (Used quotes around groups with spaces in them)
 from a text file list of user email addresses (one user per line)
 
.PARAMETER Userlist
 The full path to the userlist text file (ex: c:\temp\userlist.txt)
 
.PARAMETER Groupname
 The name of the group object in active directory (CN attribute value).  This name must be unique in the 
 forest, or the wrong group may be selected

.EXAMPLE
 Add-BulkUserByEmail -userlist c:\temp\userlist.txt -groupname "My Distro List group"
 
#>

Friday, June 8, 2012

Puchong Chinese Methodist Church

Dear Puchong Chinese Methodist Church,

Thank you for the pamphlet that you recently left at my house.  I see some respect for the laws of the land relating to not proselytizing to Muslims, but if you are going to get around the law with a disclaimer, you should write it on the front instead of the back.  Presentation of your ideas via deception is not a good way to start representing yourselves to others.  Additionally, you may have noticed the arabic "As salamu alaikum" sign on my front door.  This may have been confusing to you as this was the greeting used by Jesus, however typically any sign in arabic used in Malaysia would indicate either a Malay or a Muslim.  Since your church seems to be exclusive to a particular race, you could have saved the paper.

Since you desired to "save me", let me return the favor by helping you through the truth.  First of all, you may not be aware of the formation of the book that you are quoting.  This is something you should definitely research, while looking at the contents through an objective viewpoint.  You should be aware that the old testament is not in its original form, and the new testament is pieced together bits from thousands of documents (all conflicting) which only contains what certain sects didn't feel like burning.  Most of the followers of Jesus that had differing viewpoints were put to death by their fellow Christians.  What was left was a doctrine laced with pagan concepts brought in by converts, and philosophical ideas from the Greek and Roman empires. The result was an anonymously written new testament that comes from mostly Paul or people using his ideas.  If you make a list of what is said by Paul and what is said by Jesus, the contradictions are like night and day.  The interesting point to note is that the 12 disciples of Jesus thought Paul was a heretic and even admonished him for his false preaching.  You can find bits of that still in the bible, and some of the rest in historical sources related to the early church.  So who would know the real teachings of Jesus better: the people that were with him, or the heretic that never met him?

As I read through you pamphlet, I am first discouraged by the comic book cartoon nature of it.  I'm sure you have read the second commandment and know its views on making images of living creatures.  In any case, lets go through them one by one:

1) (Romans 3:23) Everyone has sinned and is not close to being as good as God.  Obviously right.

2) (Thessalonians 1:9) There will be punishment.  Correct

3) (Matthew 7:13-14) Not many find the true way.  Its interesting that you pull from Matthew 7, while ignoring the context of the statement.  Jesus is saying here that very few people will find the true path and follow it.  Yet, he also states that they were be many false prophets who can be identified by their actions. The important thing to keep in mind here is he is addressing his followers and given them a vision of the future. So he is stating that the majority of people who claim to follow him will be lead astray. A critical read of Paul's own letters shows clearly what kind of person he was.  He can't even keep his own story of the vision consistent. Anyways, further down in Matthew 7, 21-23 you find Jesus demonstrating that the wide path to destruction will be full of people who think they are on the path of Jesus.  Again we go back to teachings of Jesus vs the philosophical ramblings of Paul, compare that to what the church is teaching, and you find that you have violated the first commandment.  That one that Jesus said was the most important.  So, please try to find the true path, as you are very likely not on it.

4) (John 14:6)  Jesus: I am the way.  Indeed, though you are looking at it in the wrong way.  Jesus was the example for you to follow.  The law is laid down and nothing is to be taken away from it.  He followed the law (God is one, don't eat pork, no statues, no false Gods, etc).  He prayed to the Lord (not himself...that One God).  Jesus was sent to the Jews, not the gentiles (I don't think Chinese are descendants from the tribe of Israel).  Jesus prayed to his Lord by prostrating (Just like Abraham and many others throughout the bible... Who still prays by prostrating?.  Have you become too proud to follow the example of the prophets?).  In any case, if you look at the work of biblical historians, very little can be authentically traced back to Jesus, so knowing what the way is by reading the bible is not going to give you a good result.  Luckily for you there is one book that was sent by God, which has been preserved and not modified by man.
O People of the Scripture, do not commit excess in your religion or say about Allah except the truth. The Messiah, Jesus, the son of Mary, was but a messenger of Allah and His word which He directed to Mary and a soul [created at a command] from Him. So believe in Allah and His messengers. And do not say, "Three"; desist - it is better for you. Indeed, Allah is but one God. Exalted is He above having a son. To Him belongs whatever is in the heavens and whatever is on the earth. And sufficient is Allah as Disposer of affairs. (Sura #4 verse 171)

5) (John 3:16)  God gave his only son.  According the bible God has a lot of son's.  If the whole idea is that God created a world, God created laws, God forced a lot of sin on everyone, and everyone was too evil to be redeemed...what you are really saying is one of two things:  1) God is stupid, or 2) God is not Just and had to give up on all of us.  In both cases you are saying God is not All Knowing, nor is he capable of forgiving sin by Himself, nor is he in control of Judgement, nor is He All Powerful.  He wouldn't have to sacrifice anyone to remove sin when he can forgive it at will.  If God forced original sin, or the sins of the parents/society on to the children it would not be a fair and just design.  Think of it in terms of the current world financial crisis; should grandchildren be drown by a nation's debt because of today's spending?  God designing the world this way is like a loan shark chasing your family for a few ringgit, then giving up and getting a real job.

In any case, God himself addresses you with this issue in his book.  In Surah #18 verse 1-5

All Praise is due to Allah, who has sent down upon His Servant the Book and has not made therein any deviance.

He has made it straight, to warn of sever punishment from Him and to give good tidings to the believers who do righteous deeds that they will have a good reward.

In which they will remain forever

An to warn those who say, "Allah has take a son."

They have no knowledge of it, nor had their fathers.  Grave is the word that comes out of their mouths; they speak not except a lie.
I know you may be thinking, but when "son of God" is used with Jesus, there is a capital S to show that it is not the same relationship.  Please show me a capital letter in hebrew, or aramaic.  There aren't any.  The Konie greek versions were written in all capital letters.  And there are no original manuscripts anyways, so you are probably working with a translation or copy of copy, with various scribe injected bias.  As for the "begotten son" argument, there are other begotten/first born Son's of God in the other parts of the bible that you may often skip over.

6) (1 John 1:9) Confess sins.  God knows what we do.  Repentance is the important part.  Speaking about it is not enough, you need to stop doing it and make up for the wrongs you commit.

7) (Romans 10:9) I'm not even going to write what this says because it violates the first commandment.  You know that one which Jesus said was the most important one.  Maybe there is a reason he always called himself Son of Man.  Earlier in this same passage, we have Paul's philosophy declaring the Law to be dissolved, yet we have Jesus saying the Law will never go away until the end of the world.  Paul vs Jesus, if you want to say Jesus is God, then maybe he would be a better person to listen to instead of the guy that misquotes the old testament and makes up whatever he wants.

8)  (no verse)

9)  (no verse) Hell.  Scary stuff, keep researching to make sure you don't end up there.  If you read all of the revelations of God, you will find that the only sin that will not be forgiven is when you assign partners with God (violate the first commandment). There is no solid evidence of trinity, and there are many solid evidences against it (from Jesus's own statements and actions).  If you say Jesus is God, you are destroyed.

10) (no verse)  Did I accept Jesus by the end of the comic book.  He certainly is the Messiah and a righteous prophet of God, born to a virgin mother and produced by the command of his Lord.  But I'm not going against the first commandment.  I sincerely hope you learn the truth about Jesus before his return makes the truth evident, or you stand before your Lord and all things are clear (and it is too late to change).

Re-read Matthew 7 in its full context.  Its important that you don't end up in that group of people.  I invite you to further you studies about God by seeking all of his revealed information. Read the book of James to see the clear refutation of many of Paul's unacceptable philosophical ideas.

If by this point, you have realized that there is more you should learn about the nature of God and his scriptures, feel free to contact me for more information.  Additionally you can watch the video below for some more details about the nature of Jesus (may God bless him).

You may also find this information from a former Methodist minister and Harvard divinity school graduate to be useful

Talks with Dr Gerald Dirks

You can also listen to Hussain Yee on the importance of One God.

Monday, June 4, 2012

Trinity - summed up in one verse

 
I have seen a lot of attempts to wrap the idea of trinity (God being 3 in 1), by projecting this philosophy on to various verses in ways that make the verse mean other than what it obviously means. In other cases, there were fabricated verses inserted into the bible. And in more we have people attempting to explain away glaring contradictions by saying Jesus didn't know he was God, or was only human at that specific time...basically grasping at straws with no knowledge of the incident in question. I thought I would sum up the trinity in one verse using basic logic. The verse:

Mark 10:18       (Comparitive translations)

"Why do you call me good?" Jesus answered. "No one is good--except God alone."

This is in response to a man just calling Jesus "Good teacher" and asking for guidance on how to get eternal life. Since Jesus was a teacher of goodness and called people to the truth, this would be an appropriate title to address him with. But Jesus responds that only God is good. Lets look at this from the perspective of Jesus and God being part of a trinity.

In Trinity: Jesus = God
In Logic: Jesus says only God is good, thus stating that he is not, by his rejection of the man's
               assertion Jesus = Good, he implies Jesus != Good 
               If Jesus = God, Jesus would be the same entity and (Jesus = Good) must also be true.

Since he is rejecting this statement, then this must be true:
               Jesus != God 

Additionally, in the verse, the word used is "God", not "The Father".  So there is no means that anyone could try to say that they are still the same essence, with one being better than the other in some way.

Besides the logical argument, look how Jesus reacts to the statement.  He could have ignored it, or assumed it was a simple compliment, but he instead immediately redirected the focus to the One that is worthy of all praise...OUR LORD.  Jesus stated that the most important commandment is the first commandment; the oneness of God.  This is a perfect demonstation of giving God what is due to Him, as Jesus said, I of myself can do nothing.


There are many obvious verses that point to this truth. Even verses used to "prove" the trinity, do more to disprove it than they do to support it. I hope the Christians of the world contemplate deeply about the nature of their faith and the source of their book. Look deep for truth.  Ask yourself why none of the messengers talked about trinity or God being multiple parts.  When asked what is the most important of commandments, Jesus stated in Mark 12:29 that is the first: "Hear, O Israel: The Lord our God, the Lord is one."  Jesus points out that he is an example to follow, yet none follow his ways of doing things. For the sincere of faith, and the one that truly wants success in thereafter, pray as Jesus prayed (Matthew 26:39) and ask our Lord (the father) for guidance to see truth and to know the way to return to him with success.  It would be a tragedy if the good works you do are in vain because you haven't applied the first commandment.

Start looking for answers with sincerity.
A good place to start, The true message of Jesus


For some more points to consider, please view some points from my next post.