<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Powershell on Apuntes de root</title>
    <link>https://blog.099c.org/tags/powershell/</link>
    <description>Recent content in Powershell on Apuntes de root</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <managingEditor>jorti@pm.me (Juan Orti Alcaine)</managingEditor>
    <webMaster>jorti@pm.me (Juan Orti Alcaine)</webMaster>
    <lastBuildDate>Mon, 23 Jul 2012 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.099c.org/tags/powershell/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Script to grant dial-in access in Active Directory</title>
      <link>https://blog.099c.org/posts/script-to-grant-dial-in-access-in-active-directory/</link>
      <pubDate>Mon, 23 Jul 2012 00:00:00 +0000</pubDate><author>jorti@pm.me (Juan Orti Alcaine)</author>
      <guid>https://blog.099c.org/posts/script-to-grant-dial-in-access-in-active-directory/</guid>
      <description>&lt;p&gt;I have found that is not a trivial task to change the dial-in permission in an Active Directory user or computer because you must update the userParameters attribute at the same time that the msNPAllowDialin.&lt;/p&gt;&#xA;&lt;p&gt;In the &lt;a href=&#34;http://support.microsoft.com/kb/252398/en-us&#34; title=&#34;KB252398&#34;&gt;KB252398&lt;/a&gt;, Microsoft says to download the Active Directory Service Interface, so you can register adsras.dll, and use the ADSI interface it provides, but the download is no longer available.&lt;/p&gt;&#xA;&lt;p&gt;I have managed to create a script to allow dial-in: first, I have allowed manually a user to dial-in, and then I pick those permissions and apply them to the rest.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eliminar buzones de usuarios deshabilitados en Exchange 2010</title>
      <link>https://blog.099c.org/posts/eliminar-buzones-de-usuarios-deshabilitados-en-exchange-2010/</link>
      <pubDate>Fri, 28 Oct 2011 00:00:00 +0000</pubDate><author>jorti@pm.me (Juan Orti Alcaine)</author>
      <guid>https://blog.099c.org/posts/eliminar-buzones-de-usuarios-deshabilitados-en-exchange-2010/</guid>
      <description>&lt;p&gt;Aquí os pongo un script que borra los buzones de Exchange de los usuarios deshabilitados en AD. Comprueba que sean del tipo UserMailbox, porque hay buzones como los RoomMailbox cuyo usuario está deshabilitado, cuidado con esto.&lt;/p&gt;&#xA;&lt;p&gt;Es necesario tener instalado los &lt;a href=&#34;http://www.quest.com/powershell/activeroles-server.aspx&#34; title=&#34;Quest Powershell commands for Active Directory&#34;&gt;comandos powershell para Active Directory de Quest&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# Script que deshabilita los buzones de todos los usuarios de AD deshabilitados&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue | Out-Null&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue | Out-Null&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$DisabledMailboxes = New-Object -TypeName Microsoft.Exchange.Data.Directory.Management.Mailbox&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$DisabledMailboxes = $null&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Get-QADUser -Disabled -SizeLimit 0 | foreach-object {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   $ID = $_.samaccountname&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   $mbx = Get-Mailbox -Identity $ID -RecipientTypeDetails UserMailbox  -ErrorAction SilentlyContinue&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   If ($mbx) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      Write-Host &amp;#34;Añado a la lista: &amp;#34; $mbx.Name&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      $DisabledMailboxes += $mbx&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;If ($DisabledMailboxes) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   $DisabledMailboxes | foreach-object {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      Write-Host &amp;#34;Deshabilito el buzón: &amp;#34; $_.Name&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      $_ | Disable-Mailbox -Confirm:$false&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;   }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Get-MailboxDatabase | Clean-MailboxDatabase&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
