background preloader

Scripts

Facebook Twitter

Validate SPN mappings. Verified on the following platforms This script is tested on these platforms by the author. It is likely to work on other platforms as well. If you try it and find that it works on another platform, please add a note to the script discussion to let others know. Online peer support For online peer support, join The Official Scripting Guys Forum! To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script. Disclaimer The sample scripts are not supported under any Microsoft standard support program or service.

New-RDCManFile. Verified on the following platforms This script is tested on these platforms by the author. It is likely to work on other platforms as well. If you try it and find that it works on another platform, please add a note to the script discussion to let others know. Online peer support For online peer support, join The Official Scripting Guys Forum! Disclaimer The sample scripts are not supported under any Microsoft standard support program or service. A Module to Create Modules and Advanced Functions - Windows PowerShell Blog.

[1/3/09 Update - the original link to the attachment containing this code was broken but is now fixed. Sorry. jps] It is hard to overstate how important Modules and Advanced Functions are. If you are a PowerShell user - you need to take the time to learn these new mechanisms and use them as your first choice in implementing new functions. The reason for this is that these mechanisms are critical technologies to support SHARING. Advanced Functions provide help, parameter tab-completion, and cmdlet semantics that make it easy for other people to use your functions. Modules make it easy to package functions and use them in ways that they don't collide with each other. The only downside of using Modules and Advanced Functions is that they both require extra work when you start writing code. PS> Import-Module Module PS> Get-Command -Module Module CommandType Name Definition ----------- ---- ---------- Function New-GUID ...

Begin { }#Begin Process { Throw "Not Yet Implemented" }#Process Enjoy! Emit-XML - Windows PowerShell Blog. I was writing a demo yesterday and needed a quick and dirty way to generate some XML so I wrote the function below. This highlights a couple of changes that are coming up in CTP3 that I thought I would preview. 1) The keyword "cmdlet" is going away and we'll just have "function". Notice that now you can specify the [Parameter()] attribute on parameters. When you do that, we treat the function like a cmdlet.2) Here-strings can now NEST! The first Here-String starts the XML document with a "<Object>".

Function Emit-XML{Param ([Parameter(Mandatory=$true, ValueFromPipeline=$true)]$object) @"<Object>$( foreach ($p in $object |Get-Member -type *Property) { $Name = $p.Name $Value = $Object. Here is an usage example: I have to admit - I am VERY excited by some of the stuff we are lined up to deliver to you in V2. Importing and Exporting Credentials in PowerShell – Precision Computing. One question that comes up fairly often when dealing with (or writing!)

Secure cmdlets is how to properly handle usernames and passwords. The solution there is to use (or make) the -Credential parameter of type PSCredential. A PSCredential object helps ensure that your password stays protected in memory, unlike cmdlets that accept a straight username / password combination. If a parameter is of type PSCredential, PowerShell supports several types of input: empty: If you supply no input to a mandatory -Credential parameter, PowerShell prompts you for the username and password.string: If you supply a string to the -Credential parameter, PowerShell treats it as a username and prompts you for the password.credential: If you supply a credential object to the -Credential parameter, PowerShell accepts it as-is. This is great for interactive use, but what if you want to write an automated script for a cmdlet that accepts a -Credential parameter? Problem Solution “CachedUser“,$password Discussion. WSUS Admin Module.

Verificado nas seguintes plataformas Este script foi testado nessas plataformas pelo autor. É muito provável que funcione nessas plataformas também. Se você tentar e ver que funciona em uma outra plataforma, adicione uma nota no script de discussãote para que os demais saibam. Suporte de colegas online Para obter suporte de colegas online, ingresse no The Official Scripting Guys Forum! Para fornecer comentários ou relatar bugs em scripts de exemplo, inicie uma nova discussão na guia Discussões deste script. Aviso de isenção de responsabilidade Não existe suporte para os script de exemplo em nenhum programa ou serviço de suporte padrão da Microsoft. PowerShell Module for DHCP.

Get-AD. Verified on the following platforms This script is tested on these platforms by the author. It is likely to work on other platforms as well. If you try it and find that it works on another platform, please add a note to the script discussion to let others know. Online peer support For online peer support, join The Official Scripting Guys Forum! To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script. Disclaimer The sample scripts are not supported under any Microsoft standard support program or service. PowerShell Code Repository. Export and Import PowerShell ISE Opened Files - Windows PowerShell Blog.

Unlike other tools, PowerShell ISE doesn’t have project files. Project files are a good way to set your environment up with a well known state. Thanks to the ISE Object Model, it is possible to add some project functionality. The script below has two main functions “Export-ISEState” and “Import-ISEState”. They can be used to save files and PowerShellTabs and reopen them later. Even script contents for untitled files are saved. To save the current state (state = files and PowerShellTabs), use something like: Export-ISEState c:\temp\files.isexml To load the state later run: Import-ISEState c:\temp\files.isexml When exporting the current state the all titled files are saved with the script from my last post.

For untitled files, the contents are saved. If you like it, you can add it to your profile (psedit $profile will edit the ISE profile) or to a module imported in your profile. Lucio Silveira [MSFT] function Save-AllISEFiles Saves all ISE Files except for untitled files. If(! $file.Save() Param else. Active Directory Replication Monitor - [Powershell] [Module]