≡ Menu

PowerShell: Get Windows Cluster instances status

Using powershell, we can query the status of a given windows cluster and instances inside it. With Windows 2008, MS is offering this ability. You need to import the failoverclusters  module to use the cmdlets available to manage windows cluster.

Import cluster module:

Import-module failoverclusters

Using this module you can do variety of things in cluster like adding and deleting disk, adding and deleting network interfaces, adding and deleting any other cluster resources, what not, you can do majority of operations with this powershell module.

Now I will give you a little example about how to connect to a cluster and get instances hosted on it.

Get-Cluster -Name cluster1.domain.com | Get-ClusterGroup

The above will connect to cluster1.domain.com and returns the status of groups/instances hosted on this cluster. You can also see preferred nodes, fail-over, fail-back settings for a given group, etc. I will try to post about them when I get a changes.

For your quick reference, I am posting the cluster cmdlets (source: technet)

Add-ClusterDisk Make a new disk available for use in a failover cluster. The disk (LUN) must be exposed to all nodes in the failover cluster, and should not be exposed to any other servers.
Add-ClusterFileServerRole Create a clustered file server (resource group that includes one or more disks, on which you can create shared folders for users).
Add-ClusterGenericApplicationRole Configure high availability for an application that was not originally designed to run in a failover cluster.
Add-ClusterGenericScriptRole Configure an application controlled by a script that runs in Windows Script Host, within a failover cluster.
Add-ClusterGenericServiceRole Configure high availability for a service that was not originally designed to run in a failover cluster.
Add-ClusterGroup Add an empty resource group to the failover cluster configuration, in preparation for adding clustered resources to the group.
Add-ClusterNode Add a node (server) to a failover cluster. Before adding the new node, you should run validation tests on the existing nodes together with the proposed new node.
Add-ClusterPrintServerRole Create a clustered print server (a resource group that includes a printer and a disk for storing print job information and printer drivers).
Add-ClusterResource Add a resource to a clustered service or application (resource group) in a failover cluster.
Add-ClusterResourceDependency Add a resource to the list of resources that a particular resource depends on (using AND as the connector) within a failover cluster. Existing dependencies will remain in the list.
Add-ClusterResourceType Add a resource type to a failover cluster, and specify information such as the dynamic-link library (DLL) to use with that resource type.
Add-ClusterServerRole Add a group containing only a client access point and storage to the failover cluster configuration.
Add-ClusterSharedVolume Make a volume available in Cluster Shared Volumes in a failover cluster.
Add-ClusterVirtualMachineRole Create a clustered virtual machine, that is, a virtual machine that can be failed over if necessary to a different server in the failover cluster.
Block-ClusterAccess Prevent the specified user or users from accessing a failover cluster.
Clear-ClusterDiskReservation Clear the persistent reservation on a disk in a failover cluster.
Clear-ClusterNode Clear the cluster configuration from a node that was evicted from a failover cluster.
Get-Cluster Get information about one or more failover clusters in a given domain.
Get-ClusterAccess Get information about permissions that control access to a failover cluster.
Get-ClusterAvailableDisk Get information about the disks that can support failover clustering and are visible to all nodes, but are not yet part of the set of clustered disks.
Get-ClusterGroup Get information about one or more clustered services or applications (resource groups) in a failover cluster.
Get-ClusterLog Create a log file for all nodes (or a specific node) in a failover cluster.
Get-ClusterNetwork Get information about one or more networks in a failover cluster.
Get-ClusterNetworkInterface Get information about one or more network adapters in a failover cluster.
Get-ClusterNode Get information about one or more nodes (servers) in a failover cluster.
Get-ClusterOwnerNode For a resource in a failover cluster, get information about which nodes can own the resource. For a clustered service or application (a resource group), get information about the order of preference among owner nodes.
Get-ClusterParameter Get detailed information about an object in a failover cluster, such as a cluster resource. This cmdlet is used to manage private properties for a cluster object.
Get-ClusterQuorum Get information about the quorum configuration of a failover cluster.
Get-ClusterResource Get information about one or more resources in a failover cluster.
Get-ClusterResourceDependency Get information about the dependencies that have been configured between clustered resources in a failover cluster.
Get-ClusterResourceDependencyReport Generate a report that lists the dependencies between resources in a failover cluster.
Get-ClusterResourceType Get information about one or more resource types in a failover cluster.
Get-ClusterSharedVolume Get information about Cluster Shared Volumes in a failover cluster.
Grant-ClusterAccess Grant access to a failover cluster, either full access or read-only access.
Move-ClusterGroup Move a clustered service or application (a resource group) from one node to another in a failover cluster.
Move-ClusterResource Move a clustered resource from one clustered service or application to another within a failover cluster.
Move-ClusterSharedVolume Move a Cluster Shared Volume to ownership by a different node in a failover cluster.
Move-ClusterVirtualMachineRole Move the ownership of a clustered virtual machine to a different node.
New-Cluster Create a new failover cluster. Before you can create a cluster, you must connect the hardware (servers, networks, and storage), and run the validation tests.
Remove-Cluster Destroy an existing failover cluster. The affected servers will no longer function together as a cluster.
Remove-ClusterAccess Remove a user from the access list on the cluster.
Remove-ClusterGroup Remove a clustered service or application (also called a resource group) from a failover cluster.
Remove-ClusterNode Remove a node from a failover cluster. After the node is removed, it no longer functions as part of the cluster unless you add it back to the cluster.
Remove-ClusterResource Remove a clustered resource from the failover cluster.
Remove-ClusterResourceDependency Remove a dependency between two resources in a clustered service or application within a failover cluster.
Remove-ClusterResourceType Remove a resource type from a failover cluster.
Remove-ClusterSharedVolume Remove a volume from the Cluster Shared Volumes in a failover cluster, and place it in Available Storage in the cluster.
Repair-ClusterSharedVolume Run repair tools on a Cluster Shared Volume locally on a cluster node.
Resume-ClusterNode Resume activity on a failover cluster node after you have suspended it (that is, paused it).
Resume-ClusterResource Turn off maintenance for a disk resource or Cluster Shared Volume within a failover cluster.
Set-ClusterLog Set the size and level of detail for the cluster log.
Set-ClusterOwnerNode For a resource in a failover cluster, specify which nodes can own the resource. For a clustered service or application (a resource group), specify information about the order of preference among owner nodes.
Set-ClusterParameter Control specific properties of an object in a failover cluster, such as a resource, a group, or a network.
Set-ClusterQuorum Configure quorum options for a failover cluster.
Set-ClusterResourceDependency Specify the resources that a particular resource depends on within a failover cluster. Existing dependencies will be overwritten by the dependencies that you specify.
Start-Cluster Start the Cluster service on all nodes of the cluster on which it is not yet started.
Start-ClusterGroup Bring one or more clustered services and applications (also known as resource groups) online on a failover cluster.
Start-ClusterNode Start the Cluster service on a node in a failover cluster.
Start-ClusterResource Bring a resource online in a failover cluster.
Stop-Cluster Stop the Cluster service on all nodes in a failover cluster, which will stop all services and applications configured in the cluster.
Stop-ClusterGroup Take one or more clustered services and applications (also known as resource groups) offline on a failover cluster.
Stop-ClusterNode Stop the Cluster service on a node in a failover cluster.
Stop-ClusterResource Take a resource offline in a failover cluster.
Suspend-ClusterNode Suspend activity on a failover cluster node, that is, pause the node.
Suspend-ClusterResource Turn on maintenance for a disk resource or Cluster Shared Volume so that you can run a disk maintenance tool without triggering failover.
Test-Cluster Run validation tests for failover cluster hardware and settings. Tests can be run both before and after a cluster is set up.
Test-ClusterResourceFailure Simulate a failure of a cluster resource.
Update-ClusterIPResource Renew or release the DHCP lease for an IP address resource in a failover cluster.
Update-ClusterVirtualMachineConfiguration Refresh the configuration of a clustered virtual machine within a failover cluster.
{ 0 comments }

Do you like one liners in powershell? Here is the quick and easy way to start, stop, restart a service on remote computer. This doesn’t require PowerShell remoting. That means you can use it against any computer which has windows operating system installed.

So far I have authored two articles on managing services using powershell:

  1. Start/Stop/Restart service on remote computer with powershell
  2. PowerShell: Start and stop services on remote computer with alternate credentials

The first one I wrote when I was not matured enough with PowerShell and the second one recently to address a specific requirement where user need to pass alternate credentials to manage services.

As most system administrators love to use poweshell one-liners which avoids any external script/module invocation, I want to share this little one which starts, stops, and restarts a service on remote computer.

Start a service on remote computer:

Start-Service -InputObject $(Get-Service -Computer COMPUTER1 -Name spooler)

Stop a service on remote computer:

Stop-Service -InputObject $(Get-Service -Computer COMPUTER1 -Name spooler)

Restart a service on remote computer:

Restart-Service -InputObject $(Get-Service -Computer COMPUTER1 -Name spooler)

Hope these little ones helps.

{ 15 comments }

We want to assign output of a cmdlet/function to a variable so that we can use it in further processing. In scripts it is very inconvenient to debug a issue if the output is going to a variable and not to console. In such cases we can do nothing other than printing the variable value to the console by inserting extra lines of code.

To avoid such inconvenience, powershell has got a way to assign the output to a variable and print to console at the same time. This helped me in quick debugging of my scripts and oneliners.

Ok. Enough explaining about the usage and all and here is how it works.

($service = Get-Service -Name spooler)

Execute the command and you will understand what exactly it is doing. All we need to do it embed the whole command into into brackets like shown above.

Hope this little one helps you. Happy learning.

 

 

{ 1 comment }

This is a tiny post and I am going to talk about DNS name resolution using using PowerShell. Using this you can resolve hostname to IP address and IP address to hostname. For demonstration purpose, I will use google.com for name resolution.

To resolve a DNS name to IP address:

[System.Net.DNS]::GetHostAddresses("google.com")

Similarly to resolve IP name to DNS name, try the below.

[System.Net.DNS]::GetHostByAddress("1.2.3.4")

This works for internal name resolutions as well. All you need to do is configure your internal DNS server IP address in the network connector properties.

Hope this helps.

 

{ 2 comments }

We know how to import powershell module. It is just as simple as Import-Module <MODULENAME>, but how to know the functions available in that module? That is what I am going to talk about in this post.

Whenever we import a module, we like to see what all it offers. A module can offer variety of things. Out of them, functions and cmdlets are most basic things. I am not listing full differences between function and powershell here, but for sake of beginners, in a nut shell, you can view the code of functions but not of cmdlets. Coming to the original topic, let us see how we can get the functions and cmdlets inside a powershell module.

To view the offerings of a module, first we need to import it. you can use import-module cmdlet like I described above. Once it is imported, you can view what all it offers by using Get-Command cmdlet which comes by default with powershell. See below example for clarity.

Import-Module ActiveDirectory            
Get-Command -Module ActiveDirectory

In this example, I first imported activedirectory module and I am viewing the functions and cmdlets inside it by using Get-Command. By default Get-Command returns everything. If you want to filter-out the content to see only specific items like functions, then you can use -commandtype parameter.

Get-Command -Module ActiveDirectory -CommandType cmdlet

Hope this helps…

{ 0 comments }

While having some discussion with my wife today, I came across an interesting scenario where “Active Directory Users and Computers” MMC is not showing the “Live Communications Server” tab in user properties though the LCS administrator tools are installed. I searched about same problem in internet and looks like many people have already experienced this. For some, enabling the “advanced features” option in dsa.msc MMC fixed the issue and some people installed the console on XP computers to work around the problem.

In the particular case where my wife did the troubleshooting, she found that LCS administrator tools are of 32-bit version and they were installed on a 64-bit OS server. So, what is the problem? 64-bit OS supports 32-bit right? what is the problem?.

The problem is that, when you launch dsa.msc MMC from run command, it will fire-up 64-bit version of MMC which looks like has some troubles in taking with 32-bit version of LCS tools. Hence, it is not loading the LCS related tabs in the properties of any user accounts.

To work around this problem, one can open dsa.msc in 32-bit mode by just simply typing the below command.

dsa.msc -32

You can use the similar trick to launch any MMC in 32-bit mode. After opening, just look the process name in task manager, you will find mmc.exe*32 which indicates a 32-bit process name. You will find normal mmc.exe if you run mmc without -32 switch.

I somehow felt this is interested topic every systemadmin should aware. Hence authored this post.

Hope this helps. Happy learning…

{ 3 comments }

I received a comment yesterday on most popular post of my blog(https://techibee.com/powershell/startstoprestart-service-on-remote-computer-with-powershell/693) asking for a way to start, stop, restart services using alternate credentials. I thought about it for some time and came up with below script.

Note that I am not going to use built-in cmdlets like get-service, start-service, stop-service in here since they don’t have an option to provide alternate credentials. Instead I am replying on WMI class Win32_Process which allows me to pass the credentials when I use through Get-WMIObject cmdlet.

Here is the code.

$credential = Get-Credential
$myservice = Get-WmiObject -Class Win32_Service -ComputerName SERVER1 ` -Credential $credential -Filter "Name='spooler'"
$myservice.stopservice()

It is that simple. Similarly if you want to start the service just use “startservice” method like given below.

$credential = Get-Credential
$myservice = Get-WmiObject -Class Win32_Service -ComputerName SERVER1 `
-Credential $credential -Filter "Name='spooler'"
$myservice.startservice()

Hope this helps and this article also gains some popularity.

 

 

 

 

{ 10 comments }

Often we see below message when we try connecting to a console of virtual machine using Virtual Center MMC.

“Number of Active Connections has changed. There are now X active connections to this console.”

All it indicates is someone else is also sharing the console. Most VMware admins found it frustrating because, it is diverting the attention and even if you close it, it will pop-up again. Looks like there is no option to disable this message. Read http://communities.vmware.com/thread/81825 if you need more details about the problem.

Since there is no way available around to disable that, can we have some workaround? One thing we can do is ask the persons who are currently connected to disconnect their sessions. But the question here is “how we know who all are connected”? There is no straight forward option in GUI to find out the users, but you can use VMware powershellCLI to get this information.

 

function Get-VMConsoleConnectedUser {            
param (            
$VmName,            
$VCName            
)            

Connetct-VIServer -Server $VCName            
$VMEntity = Get-VM $VMName            
Get-VIEvent -Start (Get-Date).addhours(-5) -Enity $VMEntity | ? `
{$_.FullFormattedMessage -like "Remote Console*"} | select Username,FullFormattedMessage, createdtime            

}

A few things you should keep in mind before using the above function:

  • You should execute this from a powershell console where PowerCLI add-in is available
  • This function is not having any error handling capabilities
  • By default script looks for remote console logins in last 5 hours. Change the (get-date).addhours(-5) section if you would to change it.
  • Always test it before you run in production

This is my first attempt to manage VMware Virtual center with powershell.

Hope this article helps.

 

{ 0 comments }

PowerShell: Convert your VB scripts to PowerShell

The popularity of PowerShell is increasing day-to-day and now every System administrator want to say bye to their VB scripts and enter the powerful powershell world. A system administrator who is familiar with VB script(or has in home grown scripts in VB) want to try powershell, the first question he gets into mind is, “how to do xyz task in powershell”. Of course, we can ask our big brother google.com but it will take little long to find the powershell way of coding a task.

For those kind of admins, MS has published a long list of converting xyz from VB script to PowerShell. This pretty much enough for a person who wants to convert their VB scripts into powershell code. For your easy reference I am posting the content from MS technet site to here.

Hope this helps…

Cmdlets and Add-ons
Converting Dictionary Object to Windows PowerShell Commands
Converting VBScript Commands to Windows PowerShell Commands
Converting VBScript’s Abs Function
Converting VBScript’s Addition Operator
Converting VBScript’s And Operator
Converting VBScript’s Array Function
Converting VBScript’s Asc Function
Converting VBScript’s Assignment Operator
Converting VBScript’s Atn Function
Converting VBScript’s CBool Function
Converting VBScript’s CByte Function
Converting VBScript’s CCur Function
Converting VBScript’s CDate Function
Converting VBScript’s CDbl Function
Converting VBScript’s CInt Function
Converting VBScript’s CLng Function
Converting VBScript’s CSng Function
Converting VBScript’s CStr Function
Converting VBScript’s Call Statement
Converting VBScript’s Chr Function
Converting VBScript’s Class Statement
Converting VBScript’s Clear Method
Converting VBScript’s Concatenation Operator
Converting VBScript’s Const Statement
Converting VBScript’s Cos Function
Converting VBScript’s CreateObject Function
Converting VBScript’s Date Function
Converting VBScript’s DateAdd Function
Converting VBScript’s DateDiff Function
Converting VBScript’s DatePart Function
Converting VBScript’s DateSerial Function
Converting VBScript’s DateValue Function
Converting VBScript’s Day Function
Converting VBScript’s Dim Statement
Converting VBScript’s Division Operator
Converting VBScript’s Do…Loop Statement
Converting VBScript’s Eqv Operator
Converting VBScript’s Erase Statement
Converting VBScript’s Err Object Description Property
Converting VBScript’s Err Object HelpContext Property
Converting VBScript’s Err Object HelpFile Property
Converting VBScript’s Err Object Number Property
Converting VBScript’s Err Object Source Property
Converting VBScript’s Escape Function
Converting VBScript’s Eval Function
Converting VBScript’s Execute Statement
Converting VBScript’s ExecuteGlobal Statement
Converting VBScript’s Exit Statement
Converting VBScript’s Exp Function
Converting VBScript’s Exponentiation Operator
Converting VBScript’s Filter Function
Converting VBScript’s Fix Function
Converting VBScript’s For Each…Next Statement
Converting VBScript’s For…Next Statement
Converting VBScript’s FormatCurrency Function
Converting VBScript’s FormatDateTime Function
Converting VBScript’s FormatNumber Function
Converting VBScript’s FormatPercent Function
Converting VBScript’s Function Statement
Converting VBScript’s GetLocale Function
Converting VBScript’s GetObject Function
Converting VBScript’s GetRef Function
Converting VBScript’s Hex Function
Converting VBScript’s Hour Function
Converting VBScript’s If…Then…Else Statement
Converting VBScript’s Imp Operator
Converting VBScript’s InStr Function
Converting VBScript’s InStrRev Function
Converting VBScript’s InputBox Function
Converting VBScript’s Int Function
Converting VBScript’s Integer Division Operator
Converting VBScript’s Is Operator
Converting VBScript’s IsArray Function
Converting VBScript’s IsDate Function
Converting VBScript’s IsEmpty Function
Converting VBScript’s IsNull Function
Converting VBScript’s IsNumeric Function
Converting VBScript’s IsObject Function
Converting VBScript’s Join Function
Converting VBScript’s LBound Function
Converting VBScript’s LCase Function
Converting VBScript’s LTrim Function
Converting VBScript’s Left Function
Converting VBScript’s Len Function
Converting VBScript’s LoadPicture Function
Converting VBScript’s Log Function
Converting VBScript’s Mid Function
Converting VBScript’s Minute Function
Converting VBScript’s Mod Operator
Converting VBScript’s Month Function
Converting VBScript’s MonthName Function
Converting VBScript’s MsgBox Function
Converting VBScript’s Multiplication Operator
Converting VBScript’s Not Operator
Converting VBScript’s Now Function
Converting VBScript’s Oct Function
Converting VBScript’s On Error Statement
Converting VBScript’s Option Explicit Statement
Converting VBScript’s Or Operator
Converting VBScript’s Property Get Statement
Converting VBScript’s Property Let Statement
Converting VBScript’s Property Set Statement
Converting VBScript’s Public Statement
Converting VBScript’s RGB Function
Converting VBScript’s RTrim Function
Converting VBScript’s Raise Method
Converting VBScript’s Randomize Statement
Converting VBScript’s ReDim Statement
Converting VBScript’s Rem Statement
Converting VBScript’s Replace Function
Converting VBScript’s Right Function
Converting VBScript’s Rnd Function
Converting VBScript’s Round Function
Converting VBScript’s ScriptEngine Function
Converting VBScript’s ScriptEngineBuildVersion Function
Converting VBScript’s ScriptEngineMajorVersion Function
Converting VBScript’s ScriptEngineMinorVersion Function
Converting VBScript’s Second Function
Converting VBScript’s Select Case Statement
Converting VBScript’s Set Statement
Converting VBScript’s SetLocale Function
Converting VBScript’s Sgn Function
Converting VBScript’s Sin Function
Converting VBScript’s Space Function
Converting VBScript’s Split Function
Converting VBScript’s Sqr Function
Converting VBScript’s Stop Statement
Converting VBScript’s StrComp Function
Converting VBScript’s StrReverse Function
Converting VBScript’s String Function
Converting VBScript’s Sub Statement
Converting VBScript’s Subtraction Operator
Converting VBScript’s Tan Function
Converting VBScript’s Tan Function
Converting VBScript’s Time Function
Converting VBScript’s TimeSerial Function
Converting VBScript’s TimeValue Function
Converting VBScript’s Timer Function
Converting VBScript’s Trim Function
Converting VBScript’s TypeName Function
Converting VBScript’s UBound Function
Converting VBScript’s UCase Function
Converting VBScript’s Unescape Function
Converting VBScript’s Vartype Function
Converting VBScript’s Weekday Function
Converting VBScript’s WeekdayName Function
Converting VBScript’s While…Wend Statement
Converting VBScript’s With Statement
Converting VBScript’s Xor Operator
Converting VBScript’s Year Function
Converting Windows Script Host Methods to Windows PowerShell Commands
Converting the Dictionary Object’s Add Method
Converting the Dictionary Object’s CompareMode Property
Converting the Dictionary Object’s Exists Method
Converting the Dictionary Object’s Item Property
Converting the Dictionary Object’s Items Method
Converting the Dictionary Object’s Key Property
Converting the Dictionary Object’s Keys Method
Converting the Dictionary Object’s Remove Method
Converting the Dictionary Object’s RemoveAll Method
Converting the FileSystemObject to Windows PowerShell Commands
Converting the FileSystemObject’s Add Method
Converting the FileSystemObject’s AtEndOfLine Property
Converting the FileSystemObject’s AtEndOfStream Property
Converting the FileSystemObject’s AvailableSpace Property
Converting the FileSystemObject’s BuildPath Method
Converting the FileSystemObject’s Close Method
Converting the FileSystemObject’s Column Property
Converting the FileSystemObject’s Copy Method
Converting the FileSystemObject’s CopyFile Method
Converting the FileSystemObject’s CopyFolder Method
Converting the FileSystemObject’s CreateFolder Method
Converting the FileSystemObject’s CreateTextFile Method
Converting the FileSystemObject’s DateCreated Property
Converting the FileSystemObject’s DateLastAccessed Property
Converting the FileSystemObject’s DateLastModified Property
Converting the FileSystemObject’s Delete Method
Converting the FileSystemObject’s DeleteFile Method
Converting the FileSystemObject’s DeleteFolder Method
Converting the FileSystemObject’s Drive Property
Converting the FileSystemObject’s DriveExists Method
Converting the FileSystemObject’s DriveLetter Property
Converting the FileSystemObject’s DriveType Property
Converting the FileSystemObject’s Drives Property
Converting the FileSystemObject’s FileExists Method
Converting the FileSystemObject’s FileSystem Property
Converting the FileSystemObject’s Files Property
Converting the FileSystemObject’s FolderExists Method
Converting the FileSystemObject’s FreeSpace Property
Converting the FileSystemObject’s GetAbsolutePathName Method
Converting the FileSystemObject’s GetBaseName Method
Converting the FileSystemObject’s GetDrive Method
Converting the FileSystemObject’s GetDriveName Method
Converting the FileSystemObject’s GetExtensionName Method
Converting the FileSystemObject’s GetFile Method
Converting the FileSystemObject’s GetFileName Method
Converting the FileSystemObject’s GetFileVersion Method
Converting the FileSystemObject’s GetFolder Method
Converting the FileSystemObject’s GetParentFolderName Method
Converting the FileSystemObject’s GetSpecialFolder Method
Converting the FileSystemObject’s GetStandardStream Method
Converting the FileSystemObject’s GetTempName Method
Converting the FileSystemObject’s IsReady Property
Converting the FileSystemObject’s IsRootFolder Property
Converting the FileSystemObject’s Line Property
Converting the FileSystemObject’s Move Method
Converting the FileSystemObject’s MoveFile Method
Converting the FileSystemObject’s MoveFolder Method
Converting the FileSystemObject’s Name Property
Converting the FileSystemObject’s OpenAsTextStream Method
Converting the FileSystemObject’s OpenTextFile Method
Converting the FileSystemObject’s ParentFolder Property
Converting the FileSystemObject’s Path Property
Converting the FileSystemObject’s Read Method
Converting the FileSystemObject’s ReadAll Method
Converting the FileSystemObject’s ReadLine Method
Converting the FileSystemObject’s RootFolder Property
Converting the FileSystemObject’s SerialNumber Property
Converting the FileSystemObject’s ShareName Property
Converting the FileSystemObject’s ShortName Property
Converting the FileSystemObject’s ShortPath Property
Converting the FileSystemObject’s Size Property
Converting the FileSystemObject’s Skip Method
Converting the FileSystemObject’s SkipLine Method
Converting the FileSystemObject’s SubFolders Property
Converting the FileSystemObject’s TotalSize Property
Converting the FileSystemObject’s Type Property
Converting the FileSystemObject’s VolumeName Property
Converting the FileSystemObject’s Write Method
Converting the FileSystemObject’s WriteBlankLines Method
Converting the FileSystemObject’s WriteLine Method
Converting the Windows Script Host AddWindowsPrinterConnection Method
Converting the Windows Script Host AppActivate Method
Converting the Windows Script Host Close Method
Converting the Windows Script Host ConnectObject Method
Converting the Windows Script Host Count Method
Converting the Windows Script Host CreateObject Method
Converting the Windows Script Host DisconnectObject Method
Converting the Windows Script Host Echo Method
Converting the Windows Script Host EnumNetworkDrives Method
Converting the Windows Script Host EnumPrinterConnections Method
Converting the Windows Script Host Exec Method
Converting the Windows Script Host Execute Method
Converting the Windows Script Host Exists Method
Converting the Windows Script Host ExpandEnvironmentStrings Method
Converting the Windows Script Host GetObject Method
Converting the Windows Script Host GetResource Method
Converting the Windows Script Host LogEvent Method
Converting the Windows Script Host MapNetworkDrive Method
Converting the Windows Script Host Popup Method
Converting the Windows Script Host Quit Method
Converting the Windows Script Host Read Method
Converting the Windows Script Host ReadAll Method
Converting the Windows Script Host ReadLine Method
Converting the Windows Script Host RegDelete Method
Converting the Windows Script Host RegRead Method
Converting the Windows Script Host RegWrite Method
Converting the Windows Script Host Remove Method
Converting the Windows Script Host RemoveNetworkDrive Method
Converting the Windows Script Host RemovePrinterConnection Method
Converting the Windows Script Host Run Method
Converting the Windows Script Host Save Method
Converting the Windows Script Host SendKeys Method
Converting the Windows Script Host SetDefaultPrinter Method
Converting the Windows Script Host ShowUsage Method
Converting the Windows Script Host SignFile Method
Converting the Windows Script Host Skip Method
Converting the Windows Script Host SkipLine Method
Converting the Windows Script Host Sleep Method
Converting the Windows Script Host Terminate Method
Converting the Windows Script Host VerifyFile Method
Converting the Windows Script Host Write Method
Converting the Windows Script Host WriteBlankLines Method
Converting the Windows Script Host WriteLine Method
Introduction to Windows PowerShell Transactions
Introduction to Windows PowerShell 2.0 CTP v2
Join the Social
Remoting Quoting
Script Editors
Searching Active Directory with Windows PowerShell
Select-String Cmdlet Updates
Specops Command
The Get-Random Cmdlet
The Out-GridView Cmdlet: Displaying Information in a Data Grid
The Out-Gridview Cmdlet: Filter With Out-GridView
The Set-StrictMode Cmdlet
The Windows PowerShell Debugger
WMI Enhancements in Windows PowerShell 2.0 CTP
WMI Event Monitoring
Workflow Studio
{ 0 comments }

Originating DC means the Domain controller on which the object is created first. From the originating DC, the changes will replicate to other DCs in the domain. Some times this information is useful/crucial to know where exactly the object is created. This helps is troubleshooting AD replication related issues and sometimes in forensic investigation.

When ever a object is created in active directory, it stores the originating DC name in the meta data of that object. Meta data is something which we can not see from the general AD management tools like dsa.msc or adssite.msc. To view meta data, either we need to use repadmin or the dotnet object. You all know how to use repadmin so in this post I will give you a powershell script which displays the metadata of a given object.

$Domain = "techibee.com"
$objectDN = "cn=user1,cn=users,dc=techibee,dc=com"
$context = new-object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain",$domain)
$dc = [System.DirectoryServices.ActiveDirectory.DomainController]::findOne($context)
$meta = $dc.GetReplicationMetadata($objectDN)
$meta.values

The above script takes two arguments, domain name and object DN and lists all the attributes and their originating DC names. Hope this helps…

 

{ 2 comments }