Windows server 2003 – How to check FSMO role holders

Posted by aidas | Posted in Command line, Scripting, Windows 2003 | Posted on 14-06-2009

0

I`ll show you two quick ways to check FSMO roles on Windows 2003 server.

1. open command line and type :

netdom query fsmo

2. copy this code to notepad and save as fsmo.vbs script :

Set objRootDSE = GetObject(”LDAP://rootDSE”)

Set objSchema = GetObject _
(”LDAP://” & objRootDSE.Get(”schemaNamingContext”))
strSchemaMaster = objSchema.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strSchemaMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Forest-wide Schema Master FSMO: ” & objComputer.Name

Set objNtds = Nothing
Set objComputer = Nothing

Set objPartitions = GetObject(”LDAP://CN=Partitions,” & _
objRootDSE.Get(”configurationNamingContext”))
strDomainNamingMaster = objPartitions.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strDomainNamingMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Forest-wide Domain Naming Master FSMO: ” & objComputer.Name

Set objDomain = GetObject _
(”LDAP://” & objRootDSE.Get(”defaultNamingContext”))
strPdcEmulator = objDomain.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strPdcEmulator)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Domain’s PDC Emulator FSMO: ” & objComputer.Name

Set objRidManager = GetObject(”LDAP://CN=RID Manager$,CN=System,” & _
objRootDSE.Get(”defaultNamingContext”))
strRidMaster = objRidManager.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strRidMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Domain’s RID Master FSMO: ” & objComputer.Name

Set objInfrastructure = GetObject(”LDAP://CN=Infrastructure,” & _
objRootDSE.Get(”defaultNamingContext”))
strInfrastructureMaster = objInfrastructure.Get(”fSMORoleOwner”)
Set objNtds = GetObject(”LDAP://” & strInfrastructureMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo “Domain’s Infrastructure Master FSMO: ” & objComputer.Name

Then open command line and type:

cscript fsmo.vbs



Windows tips – How to hide file in Alternate Data Streams (ADS)

Posted by aidas | Posted in Windows 2003, Windows XP | Posted on 14-06-2009

0

This post will show you how to hide file in Alternate Data Streams.

ADS (Alternate Data Streams) is a “feature” of the NTFS that permit files to be completely hidden from the system.

Lets say we have  secret.txt file that contains confidential info and it is placed in C:\Test folder . We want to hide secret.txt file from unwanted eyes and hidden file attribute is too simple solution for us.

secret

In this case we can use ADS feature to completely hide it from system. Lets fork secret.txt file to C:\Windows\Zapotec.bmp file which is one of desktop backgrounds installed by default on Windows XP.

To fork it press “Start” > “Run”, type cmd and press “OK”.

In command line window type:

type c:\test\secret.txt > c:\Windows\Zapotec.bmp:secret.txt

ads-hide

Press “Enter”.

Ok, you forked secret.txt file to zapotec.bmp.

Now go to c:\Test folder and delete secret.txt file. Yep, you got it right, delete it.

After that you can start windows Search and try to locate secret.txt file. No traces… it is gone…

And now the Magic moment!

Open command line and type:

notepad c:\Windows\Zapotec.bmp:secret.txt

and press “Enter”

ads-show

Secret info file is there and it is hidden pretty well this time.

Well done!

Windows tips – How to view hidden files and folders

Posted by aidas | Posted in Windows 2003, Windows XP | Posted on 14-06-2009

0

This post will show you how to view hidden files and folders on your Windows machine.

To do it press “Start” > “Run” and type:

control folders

Press “OK”.

In “Folder options” window select “View” tab and navigate down to “Hidden files and folders” options.

folder-options

As you can see, by default, “Do not show hidden files and folders” option is selected.

Select “Show hidden files and folders” option, press “Apply” and “OK”.

You are Done!