Skip to main content

Posts

Showing posts from September, 2011

Grant Registry Permissions

I needed to configure several of our severs to grant authenticated users the ability to create event log sources. I have done this in the past, but I hated the syntax, so, I created a small little function that makes it cleaner for my fellow admins to read. I really wish small things like this were built-in.
function Grant-RegistryPermission {  param(          [Parameter(Mandatory=$true)]          [string] $Path,          [Parameter(Mandatory=$true)]          [string] $Identity,          [Parameter(Mandatory=$true)]          [Security.AccessControl.RegistryRights] $Rights,          [Security.AccessControl.InheritanceFlags] $Inheritance = [Security.AccessControl.InheritanceFlags]::None,          [Security.AccessControl.PropagationFlags] $Propagation = [Security.AccessControl.PropagationFlags]::None      )  $rule = New-Object Security.AccessControl.RegistryAccessRule $Identity,$Rights,$Inheritance,$Propagation,Allow  $acl = Get-Acl$Path$acl.AddAccessRule($rule)  Set-Acl -Path $Path -Acl …

Asynchronous FIM Run Profile Execution

Update 2011-09-21: I updated the output of the job to be a custom PSObject with more detail about the job.

I am finally to the point in my FIM project where I need to start automating tasks. I took a look at several examples of using PowerShell to start FIM Run Profiles. I wasn't quite satisfied with them as I knew I could do imports async to save time. Finally, a real reason to look into using the Start-Job cmdlet. I am hoping I can use async for exports as well. I imagine others can use this example to multi-thread other processes since it handles most of the basics.
function Start-FIMRunProfile {  param (          [Parameter(Mandatory = $true)]          [ValidateNotNullOrEmpty()]          [Alias('MA')]          [string] $MaName,          [Parameter(Mandatory = $true)]          [ValidateNotNullOrEmpty()]          [Alias('Profile')]          [Alias('Run')]          [string] $RunProfile,          [ValidateNotNullOrEmpty()]          [Alias('Computer')…