{"id":13261,"date":"2011-07-20T00:01:00","date_gmt":"2011-07-20T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2011\/07\/20\/use-the-bsonposh-powershell-module-to-check-ad-replication\/"},"modified":"2011-07-20T00:01:00","modified_gmt":"2011-07-20T00:01:00","slug":"use-the-bsonposh-powershell-module-to-check-ad-replication","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-the-bsonposh-powershell-module-to-check-ad-replication\/","title":{"rendered":"Use the BSonPoSH PowerShell Module to Check AD Replication"},"content":{"rendered":"<p><strong>Summary<\/strong>: Learn how to use the BSonPoSH Windows PowerShell module to check Active Directory replication and other tasks.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\" \/>Hey, Scripting Guy! Your article yesterday left me wondering. If there are so many cool things in the BSonPoSH module, why did you only show a couple of commands? Are there other things you can do with that module?<\/p>\n<p>&mdash;CL<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\" \/>Hello CL,<\/p>\n<p>Microsoft Scripting Guy Ed Wilson here. Today, I have the <a href=\"https:\/\/www323.livemeeting.com\/lrs\/8000181573\/Registration.aspx?PageName=j5mdg2340ds2nr6z\">Virtual PowerShell Users Group meeting<\/a> at 1:00 PM Eastern Time. I will be talking about using Windows PowerShell to work with performance counters for SQL Servers. It will be way cool, and as you know, it is something I have been looking forward to for quite some time. Tomorrow (July 21, 2011), we will be in Columbus, Ohio, for the <a href=\"http:\/\/powershellgroup.org\/content\/july-central-ohio-powershell-users-group-location-change\">Central Ohio PowerShell Users Group meeting<\/a>. They have announced a location for this meeting, so make sure you check it out. On Saturday, July 23, 2011, we will be at the <a href=\"http:\/\/www.sqlsaturday.com\/80\/eventhome.aspx\">SQLSaturday in Wheeling, West Virginia<\/a>, so there is lots of fun this week. Check out the <a href=\"http:\/\/technet.microsoft.com\/en-us\/scriptcenter\/hh182567\">Scripting Guys Community page<\/a> for upcoming virtual and live events.&nbsp;<\/p>\n<p>CL, in <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2011\/07\/19\/use-the-bsonposh-powershell-module-to-simplify-ad-tasks.aspx\">yesterday&rsquo;s article<\/a> I talked about downloading and installing the BSonPoSH module. Today, I would like to continue exploring the BSonPoSH module, and see some of the cool things it can accomplish.<\/p>\n<p>One of my favorite commands is the <b>Ping-Subnet<\/b> command. It allows me to ping all the devices on my subnet or any other subnet. The command returns the IP addresses that reply, it but does not return the ones that do not reply. It is quick and easy to use. The command and associated output follow:<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Ping-Subnet -IP 192.168.1.0 -netmask \/24<\/p>\n<p style=\"padding-left: 30px\">192.168.1.40<\/p>\n<p style=\"padding-left: 30px\">192.168.1.41<\/p>\n<p style=\"padding-left: 30px\">192.168.1.42<\/p>\n<p style=\"padding-left: 30px\">192.168.1.88<\/p>\n<p style=\"padding-left: 30px\">192.168.1.101<\/p>\n<p style=\"padding-left: 30px\">192.168.1.103<\/p>\n<p style=\"padding-left: 30px\">192.168.1.97<\/p>\n<p style=\"padding-left: 30px\">192.168.1.130<\/p>\n<p style=\"padding-left: 30px\">192.168.1.151<\/p>\n<p style=\"padding-left: 30px\">192.168.1.152<\/p>\n<p style=\"padding-left: 30px\">192.168.1.153<\/p>\n<p style=\"padding-left: 30px\">192.168.1.154<\/p>\n<p style=\"padding-left: 30px\">192.168.1.161<\/p>\n<p style=\"padding-left: 30px\">192.168.1.254<\/p>\n<p>I can pipe the IP address to other commands. For example, I can send the output to <b>Get-ComputerSystem<\/b> and retrieve system names and other information. The command for such a task is shown here (the <b>% <\/b>symbol is the alias for the <b>ForEach-Object<\/b> cmdlet):<\/p>\n<p style=\"padding-left: 30px\">Ping-Subnet -IP 192.168.1.0 -netmask \/24 | % {Get-ComputerSystem -ComputerName $_ }<\/p>\n<p>The command and associated output are shown here.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4048.HSG-7-20-11-01.png\"><img decoding=\"async\" style=\"border: 0px\" title=\"Image of command and associated output\" alt=\"Image of command and associated output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4048.HSG-7-20-11-01.png\" \/><\/a><\/p>\n<p>The same technique can be used to obtain uptime information or other information as required. For example, the <b>Get-Uptime<\/b> command is shown here, with the associated output:<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-Uptime | fl *&nbsp;<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Seconds&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 14<\/p>\n<p style=\"padding-left: 30px\">Days&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0<\/p>\n<p style=\"padding-left: 30px\">Uptime&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;: \\\\NEWMRED has been up for: 0 days, 2 hours, 5 minutes, 14 second<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s<\/p>\n<p style=\"padding-left: 30px\">Minutes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 5<\/p>\n<p style=\"padding-left: 30px\">ComputerName : NEWMRED<\/p>\n<p style=\"padding-left: 30px\">Hours&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 2<\/p>\n<p>&nbsp;<\/p>\n<p><b>Note<\/b>&nbsp; &nbsp;Most of the cmdlets do not have a <i>credential <\/i>parameter; therefore, it is necessary to start the Windows PowerShell session using the credentials that will apply to the remote destination, or to use Windows PowerShell remoting. In either case, access to the BSonPoSH module becomes a consideration. If you install in the default user location, it will not be easily available to other accounts. If you install in the <b>$psHome<\/b> location, you will need administrator rights to perform the installation. If you install in a network location, the module will not show up when using the <i>listavailable <\/i>switched parameter from the <b>Get-Module<\/b> cmdlet. In addition, you will need to provide the complete path each time you load the module.<\/p>\n<p>One of my favorite commands is the <b>NetStat<\/b> command. The problem with it is that it returns strings, and as a result, it requires parsing to allow one to work with the returned data. The BSonPoSH module solves this problem with the <b>Get-NetStat<\/b> command. The basic command returns all information. The command and associated output are shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-NetStat<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Warning: column &#8220;ProcessID&#8221; does not fit into the display and was removed.<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\"><span style=\"text-decoration: underline\">Protocol<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"text-decoration: underline\">LocalAddress<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LocalPort&nbsp;&nbsp;&nbsp;&nbsp; RemoteAddress&nbsp; RemotePort&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; State&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProcessNam<\/p>\n<p style=\"padding-left: 30px\">TCP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ESTABLISHED&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System<\/p>\n<p>&nbsp;<\/p>\n<p>In addition, the <b>Get-NetStat<\/b> command returns a custom object. This object, a <b>NetStatInfo<\/b> object, is shown in the following output (<b>gm<\/b> is an alias for the <b>Get-Member<\/b> cmdlet):<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-NetStat | gm -MemberType *property*<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp; TypeName: BSonPosh.NetStatInfo<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\"><span style=\"text-decoration: underline\">Name<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"text-decoration: underline\">MemberType<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"text-decoration: underline\">Definition<\/span><\/p>\n<p style=\"padding-left: 30px\">LocalAddress&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String LocalAddress=0.0.0.0<\/p>\n<p style=\"padding-left: 30px\">LocalPort&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String LocalPort=135<\/p>\n<p style=\"padding-left: 30px\">ProcessID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String ProcessID=972<\/p>\n<p style=\"padding-left: 30px\">ProcessName&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String ProcessName=svchost<\/p>\n<p style=\"padding-left: 30px\">Protocol&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String Protocol=TCP<\/p>\n<p style=\"padding-left: 30px\">RemoteAddress&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String RemoteAddress=0.0.0.0<\/p>\n<p style=\"padding-left: 30px\">RemotePort&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String RemotePort=0<\/p>\n<p style=\"padding-left: 30px\">State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.String State=LISTENING<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p>One of the things that is fun to use is the <b>Out-Voice<\/b> command. It accepts pipeline output, and using the Speech API, it &ldquo;reads&rdquo; the output. For example, I can pipe the results from the <b>Get-Process<\/b> cmdlet to <b>Out-Voice<\/b>, and it will &ldquo;read&rdquo; the results. The command is shown here:<\/p>\n<p style=\"padding-left: 30px\">Get-Process | Out-Voice<\/p>\n<p>&nbsp;<\/p>\n<p>The <b>Out-Voice<\/b> cmdlet is also able to read text files. I can combine the <b>Get-Content<\/b> cmdlet and <b>Out-Voice<\/b> to accomplish this task. A sample command is shown here:<\/p>\n<p style=\"padding-left: 30px\">Get-Content C:\\fso\\myTextFile.txt | Out-Voice<\/p>\n<p>&nbsp;<\/p>\n<p>One word of caution here: after I pipe data to the <b>Out-Voice<\/b> command, there is no way to stop it from reading the data, except to close the Windows PowerShell console. The normal break command, Ctrl+C, cannot halt execution of the command.<\/p>\n<p>The <b>Test-ADReplication<\/b> cmdlet is one of my favorites. I wrote a <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2010\/07\/14\/hey-scripting-guy-can-i-use-group-policy-cmdlets-to-test-active-directory-replication.aspx\">Hey, Scripting Guy! Blog post about this in regards to GPOs<\/a>. This cmdlet works great and is as simple as typing the command. The command and associated output are shown here.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8424.HSG-7-20-11-02.png\"><img decoding=\"async\" style=\"border: 0px\" title=\"Image of command and associated output\" alt=\"Image of command and associated output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8424.HSG-7-20-11-02.png\" \/><\/a>&nbsp;<\/p>\n<p>CL, there are lots of other commands in the BSonPoSH module. These are just some of the highlights.<\/p>\n<p>&nbsp;<\/p>\n<p>Community Week will continue tomorrow when Guest Blogger Jeremy Engel introduces his Excel module. It is good stuff, so make sure not to miss it. &nbsp;<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to use the BSonPoSH Windows PowerShell module to check Active Directory replication and other tasks. &nbsp; Hey, Scripting Guy! Your article yesterday left me wondering. If there are so many cool things in the BSonPoSH module, why did you only show a couple of commands? Are there other things you can do [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[16,47,52,3,4,45],"class_list":["post-13261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-desktop-management","tag-general-management-tasks","tag-modules","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to use the BSonPoSH Windows PowerShell module to check Active Directory replication and other tasks. &nbsp; Hey, Scripting Guy! Your article yesterday left me wondering. If there are so many cool things in the BSonPoSH module, why did you only show a couple of commands? Are there other things you can do [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/13261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=13261"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/13261\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=13261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=13261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=13261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}