LeoPonti Blog

  • WikiNinjas Blog: Semana del 12/8 al 19/8

    Hola a todos! En esta oportunidad, les dejo los artículos que fueron publicados en la semana del 12/8 al 19/8 en el blog de TechNet WikiNinjas 19/8 Interview with a Wiki Ninja and SharePoint Guru - Matthew Yarlett Por Ed Price 19/8 July...
  • Windows Server 2012 - Generando Disco USB Booteable

    Hola a todos! En esta oportunidad, quiero compartir con ustedes una forma sencilla de hacer un dispositivo USB booteable con Windows Server 2012, de esta misma forma, también se puede hacer con Windows Server 2008R2, Windows 7 y Windows 8.-...
  • Links de Interes: Active Directory Disaster and Recovery

    Hola, En el presente post, les dejo links de interés para armado, preparación, prevención y ejecución de Disaster and Recovery. Tenemos que tener la idea en claro, que nuestra infraestructura de Active Directory es el Core...
  • Error "Access is denied" al despromover Domain Controller

    Hola a todos! En esta oportunidad, me gustaria dejarles la solucion a un inconveniente al querer despromover un Domain Controller el cual este operativo y al querer despromoverlo, les aparezca el siguiente mensaje: The operation failed because: Active...
  • Version de Schema en nuestro Forest

    Hola a todos! En esta oportunidad, quiero dejarles las formas en las que podemos chequear la versión de nuestro Schema de Active Directory, esto identificará la versión de Sistema Operativo de nuestros Domain Controllers, no en...
  • Redireccionando contenedor default de objetos Users en AD

    Hola a todos! En esta oportunidad, les quiero dejar como redireccionar el contenedor default donde quedan los objetos Users al generarse cuando desde una aplicación, se generan cuentas y se deja al dominio que las genere en un contenedor por...
  • Redireccionando contenedor default de objetos Computers en AD

    Hola a todos! En esta oportunidad, les quiero dejar como redireccionar el contenedor default donde quedan los objetos Computers al generarse cuando se hace el Join de los equipos a nuestro dominio, como ventaja principal para realizar esta tarea, es...
  • Script - Export completo de Subnets por Site en nuestro Forest

    Hola a todos! En esta oportunidad, quería dejarles un Script muy interesante, el cual nos permite exportar en pocos segundos, el detalle de las subnets que tenemos en cada uno de nuestros Site del Forest donde necesitemos tener dicho detalle...
  • PowerShell Workflow for Mere Mortals: Part 1

    Summary : Microsoft Scripting Guy, Ed Wilson, begins a five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! What is up with Windows PowerShell Workflow? Everyone acts like it is some deep, dark mystery—similar to trying to understand neutrinos . So come on…it is Windows PowerShell, so how hard can it be? —MD Hello MD, Microsoft Scripting Guy, Ed Wilson, is here. This week I am going to address some questions and comments that have been collecting about Windows PowerShell Workflow. I like using Windows PowerShell Workflow because it offers a number of significant capabilities that help solve rather interesting issues. Note This is the first in a five-part series of blog posts about Windows PowerShell Workflow for “mere mortals.” For more information, see these Hey, Scripting Guy! posts about Windows PowerShell Workflow . For a conceptual introduction, see When Windows PowerShell Met Workflow . Why use workflows Windows PowerShell Workflows are cool because the commands consist of a sequence of related activities. I can use a workflow to run commands that take an extended period of time. By using a workflow, my commands can survive reboots, disconnected sessions. They can even be suspended and resumed without losing the data. This is because the workflow automatically saves state and data at the beginning and at the end of the workflow. In addition, it can use specific points that I specify. These persistence points are like checkpoints or snapshots of the activity. If a failure occurs that is unrecoverable, I can use the persisted data points, and then resume from the last data point instead of having to begin the entire process anew. Note Windows PowerShell Workflow is Windows Workflow Foundation. But instead of having to write the workflow in XAML, I can write the workflow by using Windows PowerShell syntax. I can also package the workflow in a Windows PowerShell module. For detailed documentation, see Windows Workflow Foundation . The two main reasons to use Windows PowerShell Workflow are reliability and performance when performing large scale or long-running commands. These reasons break down into the following key points: Parallel task execution Workflow throttling Connection throttling Connection pooling Integration with disconnection sessions Workflow requirements I can run a workflow that uses Windows PowerShell cmdlets if the target (the managed...
  • PowerTip: Use PowerShell to Display Locale-Specific Date

    Summary : Learn how to use Windows PowerShell to display the date in locale-specific format. How can I use Windows PowerShell to display the day, month, and two-digit year in locale specific format? Use the Get-Date cmdlet and the –uformat parameter: get-date -UFormat %x
  • PowerShell Workflow for Mere Mortals: Part 2

    Summary : Microsoft Scripting Guy, Ed Wilson, continues a five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! So Windows PowerShell Workflow seems pretty cool. But I am wondering if it is possible to use it to easily provide workflow types of things for remote computers? Is this possible? —BB Hello BB, Microsoft Scripting Guy, Ed Wilson, is here. We are enjoying a cool stretch of weather here in Charlotte, North Carolina. In fact, we have the windows open. We are also enjoying our visiting friends from Hamburg, Germany. So not only do we have great weather, but we have great company. Note This is the second in a five-part series of blog posts about Windows PowerShell Workflow for “mere mortals.” You should read PowerShell Workflow for Mere Mortals: Part 1 before you read this post. For more information about workflow, see these Hey, Scripting Guy! Blog posts: Windows PowerShell Workflow . Parallel Windows PowerShell One of the reasons for using a Windows PowerShell Workflow is to be able to easily execute commands in parallel. This can result in some significant time savings. Note For an example of the time savings that are possible by using a Windows PowerShell Workflow and running commands in parallel, see the excellent post written by Windows PowerShell MVP, Niklas Goude, Use PowerShell Workflow to Ping Computers in Parallel . To perform a parallel activity by using Windows PowerShell Workflow, use the Foreach keyword with the –Parallel parameter. This is followed by the operation and the associated script block. The following script illustrates this technique: Foreach -Parallel ($cn in $computers) { Get-CimInstance -PSComputerName $cn -ClassName win32_computersystem } One of the things to keep in mind (as a major source of early frustration) is that when I call the Get-CimInstance cmdlet from within the script block of my parallel Foreach keyword, I have to use the automatically added PSComputerName parameter, not the ComputerName parameter I would normally use with the cmdlet. This is because this is the way that Windows PowerShell Workflow handles computer names. If I look at the command-line syntax for Get-CimInstance , I do not see the ––PSComputerName parameter at all. The nice thing is that if I forget to use –PSComputerName , and I try to run the Windows PowerShell Workflow, an error message appears. The message is detailed enough that it actually...
  • PowerTip: Customize How PowerShell Displays a Date

    Summary : Easily customize the way Windows PowerShell displays a date. How can I use Windows PowerShell to easily display the date as day-dash-month-dash-four-digit year? Use the Get-Date cmdlet,specify a custom format by using the Format parameter, and use dd for the date, M for the month and yyyy for a four-digit year (this is case sensitive): Get-Date -Format "dd-M-yyyy"
  • PowerShell Workflow for Mere Mortals: Part 3

    Summary : Microsoft Scripting Guy Ed Wilson continues his five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! So what’s up with Windows PowerShell workflows and activities? I do not know what an activity is. Can you help me? —CJ Hello CJ, Microsoft Scripting Guy, Ed Wilson, is here. Ah…this afternoon, I am sipping a cup of Darjeeling Earl Grey tea with a bit of cinnamon stick, and I added just a bit of lavender honey from a nearby lavender farm. I am accompanying my tea with a 90% cocoa bar with black currants and hazelnuts. The combination is absolutely stunning. Note This is the third in a five-part series of blog posts about Windows PowerShell Workflow for “mere mortals.” Before you read this post, please read: PowerShell Workflow for Mere Mortals: Part 1 PowerShell Workflow for Mere Mortals: Part 2 For more information about workflow, see these Hey, Scripting Guy! Blog posts: Windows PowerShell Workflow . Workflow activities A Windows PowerShell Workflow is made up of a series of activities. In fact, the basic unit of work in a Windows PowerShell Workflow is called an activity. There are five types of Windows PowerShell Workflow activities that are available for use. The following table describes the types of activities. Activity Description CheckPoint-Workflow (alias = PSPersist) Takes a checkpoint. Saves the state and data of a workflow in progress. If the workflow is interrupted or rerun, it can restart from any checkpoint. Use the Checkpoint-Workflow activity along with the PSPersist workflow common parameter and the PSPersistPreference variable to make your workflow robust and recoverable. ForEach -Parallel Runs the statements in the script block once for each item in a collection. The items are processed in parallel. The statements in the script block run sequentially. Parallel Allows all statements in the script block to run at the same time. The order of execution is undefined. Sequence Creates a block of sequential statements within a parallel script block. The Sequence script block runs in parallel with other activities in the Parallel script block. However, the statements in the Sequence script block run in the order in which they appear. Sequence is valid only within a Parallel script block. Suspend-Workflow ...
  • PowerTip: Use PowerShell to Display Date, Time, and Hour

    Summary : Use Windows PowerShell to display date, time, and hour in 24-hour format. How can I use Windows PowerShell to get the hour of the day in 24-hour format? Use the Get-Date cmdlet and specify the “%H” pattern to the UFormat parameter ( H is case sensitive): get-date -UFormat "%H"
  • PowerShell Workflow for Mere Mortals: Part 4

    Summary : Microsoft Scripting Guy, Ed Wilson, continues his five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! Yesterday you talked about Windows PowerShell Workflow activities. But you only demonstrated the Parallel activity. Is there something you can share with me about some of the other types of activities? In particular I am interested in checkpoints because I think they can help me. —AP Hello AP, Microsoft Scripting Guy, Ed Wilson, is here. This morning, it is really foggy outside. To be honest, it seems to look more like fall than the end of summer. But then, I am not a real weather person—I don’t even play one on TV. It is fairly humid and fairly cool—a nice morning for a cup of English Breakfast tea. I am not in the mood to experiment today, and so I am going with a standard recipe of mine: Three scoops of English Breakfast tea, a scoop of lemon grass, and a single crushed cinnamon stick. I let it steep for three minutes and 45 seconds, grab my tea pot, my Surface RT, and head outside to check email. AP, you want to talk about checkpoints in a Windows PowerShell workflow today. No problem… Note This is the fourth in a five-part series of blog posts about Windows PowerShell Workflow for “mere mortals.” Before you read this post, please read: PowerShell Workflow for Mere Mortals: Part 1 PowerShell Workflow for Mere Mortals: Part 2 PowerShell Workflow for Mere Mortals: Part 3 For more information about workflow, see these Hey, Scripting Guy! Blog posts: Windows PowerShell Workflow . Checkpoints Windows PowerShell workflow If I have a Windows PowerShell Workflow, and I need to save the workflow state or data to a disk while the workflow runs, I can configure a checkpoint. In this way, if something interrupts the workflow, it does not need to restart completely. Instead, the workflow resumes from the point of the last checkpoint. Setting a checkpoint in a Windows PowerShell Workflow is sometimes referred to as “persistence” or “persisting a workflow.” Because Windows PowerShell Workflows run on large distributed networks, or they control the execution of long running tasks, it is vital that the workflow can handle interruptions. Understanding checkpoints A checkpoint is a snapshot of the workflow’s current state. This includes the current values of variables and generated output. A checkpoint persists this data to...
  • PowerTip: View PowerShell Console Host Information

    Summary : View Windows PowerShell console host information. How can I easily find information about the Windows PowerShell console host? Use the Get-Host cmdlet, and select the RawUI property from the InterhostUserInterface object: (get-host).ui.RawUI
  • PowerShell Workflow for Mere Mortals: Part 5

    Summary : Microsoft Scripting Guy, Ed Wilson, concludes his five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! I have a number of commands that I want to run against several remote servers. The commands include stuff that must happen prior to something else happening. But then, there are also some things that I would like to happen as fast as possible. Is this permissible? If so, do I have to write two different workflows? —TB Hello TB, Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping an awesome cup of Oolong tea with a cinnamon stick, jasmine flower, and lemon grass. The flavor is just about perfect. In the background, I am listening to Ravel . Outside, the sky is dark and it is raining. The thunder seems to punctuate the music. Note This is the last post in a five-part series about Windows PowerShell Workflow for “mere mortals.” Before you read this post, please read: PowerShell Workflow for Mere Mortals: Part 1 PowerShell Workflow for Mere Mortals: Part 2 PowerShell Workflow for Mere Mortals: Part 3 PowerShell Workflow for Mere Mortals: Part 4 For more information about workflow, see these Hey, Scripting Guy! Blog posts: Windows PowerShell Workflow . Well TB, the good news is that you do not need to write two different workflows to enable parallel processing and sequential processing. Windows PowerShell Workflows are flexible enough to handle both in the same workflow. Adding a sequence activity to a workflow To add a sequence activity to a Windows PowerShell Workflow, all I need to do is use the Sequence keyword and specify a script block. When I do this, it causes the commands in the sequence script block to run sequentially and in the specified order. The key concept here is that a Sequence activity occurs within a Parallel activity. The Sequence activity is required when I want commands to run in a particular order. This is because commands running inside a Parallel activity run in an undetermined order. The commands in the Sequence script block run in parallel with all of the commands in the Parallel activity. But the commands within the Sequence script block run in the order in which they appear in the script block. The following workflow illustrates this technique: workflow get-winfeatures { Parallel { Get-WindowsFeature -Name PowerShell* InlineScript {$env:COMPUTERNAME} Sequence { Get-date $PSVersionTable.PSVersion...
  • PowerTip: Find PowerShell Logging Info

    Summary : Use a Windows PowerShell cmdlet to retrieve logged information about Windows PowerShell. How can I easily find logged information about Windows PowerShell? Use the Get-WinEvent cmdlet and look for a LogName with powershell in the name: Get-WinEvent -LogName *powershell*
  • Deciding How to Use PowerShell to Access AD DS

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about the decision points for deciding how to use Windows PowerShell to access Active Directory Domain Services. Hey, Scripting Guy! I am a bit confused. I see various blogs and scripts on the Script Repository, and some always use a third-party snap-in to access Active Directory Directory Domain Services (AD DS). Others seem to use .NET Framework code to access AD DS, and still others are using a module that looks like it is part of Windows PowerShell. What is the best way to access AD DS? —CB Hello CB, Microsoft Scripting Guy, Ed Wilson, is here. This morning it is actually cool here in Charlotte, North Carolina. In fact, it is way cool because the Scripting Wife found a place on the Internet so she could order some chocolate covered Macadamia nuts. By the way, they go very well with Earl Grey tea with a cinnamon stick. The chocolate, the cinnamon, and the touch of bergamot combine to create an exquisite taste sensation. So, I am out on the lanai sipping tea, nibbling on chocolate covered Macadamia nuts and checking my email on my Surface RT, and I ran across this email to scripter@microsoft.com from CB. Supportability—the big advantage When comparing options for working with Active Directory Domain Services from within Windows PowerShell, one option stands above all the others: supportability. When I use the Active Directory module from Microsoft, it is supported. For me, this means a lot. So if something does not work out perfectly, I know it is supported. I gain access to the Active Directory module in two ways. On a domain controller that is running at least Windows Server 2008 R2, I add the Active Directory management feature, and I have access to the Active Directory module. I can access it locally on the server, or I can use remoting or implicit remoting to access the cmdlets from my workstation. For more information about remoting, see Use PowerShell Active Directory Cmdlets Without Installing Any Software . I can also install the Remote Server Admin Tools (RSAT) on my workstation. The version I install depends on the version of the operating system that I have on my workstation. For more information, see What's Up with Active Directory Domain Services Cmdlets? Note If I install Active Directory Management Service for Windows Server 2008, I do not get access to the Active Directory module on the server. I must install the RSAT tools on my workstation for management...
  • PowerTip: Use PowerShell to Get BitLocker Recovery Key

    Use Windows PowerShell to get the BitLocker recovery key. ...( read more )
  • Weekend Scripter: Install Free PowerShell Remote Server Admin Tools

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about installing the free Remote Server Administration Tools for Windows PowerShell 3.0 in Windows 8. Microsoft Scripting Guy, Ed Wilson, is here. This morning is an awesome morning. Our friends from Hamburg, Germany have been hanging out all weekend, and it has been a blast. We have spent a bit of time talking about Windows PowerShell training and some of the challenges related to that. We have also shared a love for tea. Yep. It has been a great weekend. Not only that, but the weather also cooperated—it has been sunny and not too humid. One of the first things I do when I build a new computer running Windows 8, is install the Windows 8 Remote Server Administration Tools (RSAT) tools. After I do this, I gain access to many new and useful cmdlets that make it easy to administer everything from Active Directory Domain Services to Windows Software Update Services. Getting the Windows 8 RSAT tools For a free download of the tools, see Remote Server Administration Tools for Windows 8 on the Microsoft Download Center. There are two versions available on the download page: a 32-bit version and a 64-bit version. Finding the actual download is pretty easy—I click the big red Download button that is shown in the following image. I can install the RSAT tools for Windows 8 on computers running Windows 8 or Windows 8 Pro. I cannot install them on my Windows Surface RT, but I can install them on my Windows Surface Pro. The first thing I need to know is if my computer x86 or is it x64. The way that I usually find this out is to query an environmental variable as shown here: PS C:\Users\ed.IAMMRED> $env:PROCESSOR_ARCHITECTURE x86 Before I install the RSAT tools on my computer, I use the following script to to see how many cmdlets and functions are currently on my computer— I have 989. PS C:\Users\ed.IAMMRED> gcm -CommandType cmdlet, function | measure Count : 989 Average : Sum : Maximum : Minimum : Property : So I click the big red Download button to select my appropriate package. Now, I have a choice. I can download the package and install it offline. Or if I choose Run, the file spools to a Temp folder, and it performs the installation from there. This works great if I have good Internet bandwidth, and if I do not anticipate needing to perform the installation again anytime soon. I will open the file, and after a quick security scan...
  • Artículos "The Scripting Guys" semana 25/8 al 01/9

    Hola a todos! En esta oportunidad. quiero dejarles la lista de artículos publicados en el Scripting Guy! Blog durante esta semana. Realmente es excelente el trabajo de Ed Wilson!. Weekend Scripter: Creating ACLs for Windows Azure Endpoints—Part...
  • Revista LatamTechnology #10

    Revista

  • Use PowerShell to Test Remote Printers

    Summary : Learn how to use Windows PowerShell to test remote printers. Hey, Scripting Guy! I don’t know what it is, but for some reason printing still seems to be a pain. I mean, we have been using the network for a long time, and something as basic as printing still seems to be a problem. Whatever happened to the paperless office of the future? All we do is kill trees faster by using high-speed printers to print massive amounts of useless junk that no one reads. Anyway, for some reason, about half of our Help Desk calls are related to print issues. To be sure, some of it is user training issues—people trying to select the wrong feature for the wrong printer. But in all honesty, not all of the print problems are user related. For example, sometimes the print spooler seems to die, and we need to restart it. My Help Desk techs can open Computer management to stop and restart the spooler service, but I would like to do this via a script. Can you help? —RM Hello RM, Microsoft Scripting Guy, Ed Wilson, is here. We continue to get lots of rain here in Charlotte, North Carolina. Lots and lots of rain. The solar heaters for our pool are not doing much good these days. Oh well, maybe the sun will come out tomorrow. The print management module RM, you did not say if you are using Windows 8, so I am going to assume that you are. In Windows 8 (and in Surface RT, Surface Pro, and Windows Server 2012), there is a print management module called PrintManagement . It exposes the following commands: PS C:\> Get-Command -Module PrintManagement CommandType Name ModuleName ----------- ---- ---------- Function Add-Printer PrintManagement Function Add-PrinterDriver PrintManagement Function Add-PrinterPort PrintManagement Function Get-PrintConfiguration PrintManagement Function Get-Printer PrintManagement Function Get-PrinterDriver PrintManagement Function Get-PrinterPort PrintManagement Function Get-PrinterProperty PrintManagement Function Get-PrintJob PrintManagement Function Remove-Printer PrintManagement Function Remove-PrinterDriver PrintManagement Function Remove-PrinterPort PrintManagement Function Remove-PrintJob PrintManagement Function Rename-Printer PrintManagement Function Restart-PrintJob PrintManagement Function Resume-PrintJob PrintManagement Function Set-PrintConfiguration PrintManagement Function Set-Printer PrintManagement Function Set-PrinterProperty PrintManagement...
  • PowerTip: Use PowerShell to Verify Secure Boot Policy

    Summary : Use Windows PowerShell to verify your Secure Boot policy in Windows 8. How can I verify that the Secure Boot policy is enabled in my computers running Windows 8? Use the Get-SecureBootPolicy cmdlet: Get-SecureBootPolicy