Using PowerShell to start Run Profiles
Thanks to this powershell script, you can easily automatize the execution of run profiles for FIM management agents.You just have to adapt the PARAMETERS section to your needs.Here is a screenshot: And the source code: # @author: Fabien Duchene # @mail: fabien.duchene1 **at** googlemail.com ############ # PARAMETERS ############ $params_ComputerName = "." # "." is the current computer $params_delayBetweenExecs = 30 #delay between each execution, in seconds $params_numOfExecs = 0 #Number of executions 0 for infinite $params_runProfilesOrder = @( @{ type="Forefront Identity Management (FIM)"; profilesToRun=@("Full Import";"Full Synchronization"); }; @{ type="Active Directory"; profilesToRun=@("Full Import";"Full Synchronization";"Export"); }; ); ############ # FUNCTIONS ############ $line = "-----------------------------" function Write-Output-Banner([string]$msg) { Write-Output $line,("- "+$msg),$line } ############ # DATAS ############ $MAs = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root \MicrosoftIdentityIntegrationServer" -computername $params_ComputerName) $numOfExecDone = 0 ############ # PROGRAM ############ do { Write-Output-Banner("Execution #:"+(++$numOfExecDone)) foreach($MATypeNRun in $params_runProfilesOrder) { $found = $false; foreach($MA in $MAS) { if(!$found) { if($MA.Type.Equals($MATypeNRun.type)) { $found=$true; Write-Output-Banner("MA: "+$MA.Type) foreach($profileName in $MATypeNRun.profilesToRun) { Write-Output (" "+$profileName)," -> starting" $datetimeBefore = Get-Date; $result = $MA.Execute($profileName); $datetimeAfter = Get-Date; $duration = $datetimeAfter - $datetimeBefore; if("success".Equals($result.ReturnValue)){ $msg = "done. Duration: "+$duration.Hours +":"+$duration.Minutes+":"+$duration.Seconds } else { $msg = "Error: "+$result } Write-Output (" -> "+$msg) } } } } if(!$found) { Write-Output ("Not found MA type :"+$MATypeNRun.type); } } $continue = ($params_numOfExecs -EQ 0) -OR ($numOfExecDone -lt $params_numOfExecs) if($continue) { Write-Output-Banner("Sleeping "+$params_delayBetweenExecs+" seconds") Start-Sleep -s $params_delayBetweenExecs } } while($continue) You can also find more informations on my blog: http://fabienduchene.blogspot.com/2009/11/fim-execute-management-agents-run.html
November 18th, 2009 6:15pm

Very cool, Fabien, thanks for sharing the script with the community!I have added your script to the catalog page.Cheers,MarkusMarkus Vilcinskas, Knowledge Engineer, Microsoft Corporation
Free Windows Admin Tool Kit Click here and download it now
November 18th, 2009 7:15pm

Hello, I was testing with this script today and had a question. It seems in the configuration that I specify the "type" of MA that the run profiles should be selected from but I don't see how to specify the "name" of the MA that should be chosen. In my environment I will have several "Active Directory" MAs so I need to specify the MA name when I launch. is this possible in the power shell script? (sorry if this is a simple question but I'mm new to PS). Thanks.
December 13th, 2009 11:16pm

You're totally right, I selected the management agent according to its type (active directory, FIM, SAP...) but not from its name. I will check tomorrow how to select a MA by its name and will keep you posted. Cheers.
Free Windows Admin Tool Kit Click here and download it now
December 13th, 2009 11:26pm

In order to select the management agent by its name instead of by its type: $params_runProfilesOrder = @( @{ name="FIM MA"; profilesToRun=@("Export";"Delta Import";"Delta Synchronization"); }; @{ name="adds"; profilesToRun=@("Export";"Delta Import";"Delta Synchronization"); }; ); and replace the line if($MA.Type.Equals($MATypeNRun.type)) { by if($MA.Name.Equals($MATypeNRun.name)) { Cheers.
December 14th, 2009 5:57pm

Outstanding. I will test this right away. Thank you very much!
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2009 6:28pm

Something I do in my run scripts is put in a function to retrieve a MA by name, which can be assigned to a variable and then the Execute method can be called on that. If you have a lot of management agents, it can be a bit quicker and more efficient. Here's the one I use: function GetMA { param([string]$maName) $filter = "Name='" + $maName + "'" Get-WmiObject -Class MIIS_ManagementAgent -Namespace root/MicrosoftIdentityIntegrationServer -Filter $filter } I like your idea of using an array of profile names and iterating over that. I guess the next step would be to use a hashtable with the MA name as the key and the array of profiles to run. Hmmm....., serialize as XML, then you'd have a completely data-driven script that you'd never have to change.... I feel a PowerShell session coming on... James
December 14th, 2009 6:43pm

I've made a few changes to it so that it e-mails "someone" when things go wrong. # @author: Fabien Duchene # @mail: fabien.duchene1 **at** googlemail.com # @Modified by Peter Lambrechtsen to include sending errors via e-mail # including run-history if things go wrong- plambrechtsen at gmail dot com ############ # PARAMETERS ############ $params_ComputerName = "." # "." is the current computer $params_delayBetweenExecs = 30 #delay between each execution, in seconds $params_numOfExecs = 1 #Number of executions 0 for infinite $params_runProfilesOrder = @( @{ name="OracleMA"; profilesToRun=@("Load"); }; @{ name="Active Directory"; profilesToRun=@("Export";"Full Synchronization";"Export"); }; ); ################## # EMAIL PARAMETERS ################## $emailFrom = "FIM@org.com" $emailTo = "FIMAlertMailbox@org.com" $smtpServer = "smtp.org.com" ############ # FUNCTIONS ############ $line = "-----------------------------" function Write-Output-Banner([string]$msg) { Write-Output $line,$msg,$line } ############ # DATAS ############ $MAs = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $params_ComputerName) $numOfExecDone = 0 ############ # PROGRAM ############ do { Write-Output-Banner("Execution #:"+(++$numOfExecDone)) foreach($MATypeNRun in $params_runProfilesOrder) { $found = $false; foreach($MA in $MAS) { if(!$found) { # if($MA.Type.Equals($MATypeNRun.type)) { if($MA.Name.Equals($MATypeNRun.name)) { $found=$true; Write-Output-Banner("- MA Name: "+$MA.Name,"`n- Type: "+$MA.Type) # Write-Output-Banner("MA Type: "+$MA.Type) foreach($profileName in $MATypeNRun.profilesToRun) { Write-Output (" "+$profileName)," -> starting" $datetimeBefore = Get-Date; $result = $MA.Execute($profileName); $datetimeAfter = Get-Date; $duration = $datetimeAfter - $datetimeBefore; if("success".Equals($result.ReturnValue)){ $msg = "done. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds } else { $msg = "Error: "+$result # Problems with RunHistory WMI not working with MaGuid or MaName, so I used RunDetails from the MA. # $RunHistory = get-wmiobject -class "MIIS_RunHistory" -namespace "root\MicrosoftIdentityIntegrationServer" -filter("MaGuid='" + $MA.guid + "'") # # Write the RunHistory file XML out to a file to then attach to the e-mail, and also set it to a XML attribute. # $RunHistory[1].RunDetails().ReturnValue | Out-File RunHistory.xml # Grab the first run-history, which always is the latest result. # [xml]$RunHistoryXML = $RunHistory[1].RunDetails().ReturnValue #Take the MA RunDetails RunHistory XML and write to file. $MA.RunDetails().ReturnValue | Out-File RunHistory.xml # Grab the MA run-history and put it into a XML var. [xml]$RunHistoryXML = $MA.RunDetails().ReturnValue # Build User Errors for Exports $RunHistoryXML."run-history"."run-details"."step-details"."synchronization-errors"."export-error" | select dn,"error-type" | export-csv ErrorUsers.csv # Build SMTP Message $smtp = new-object Net.Mail.SmtpClient($smtpServer) $smtpmsg = new-object Net.Mail.MailMessage $smtpmsg.From = $emailFrom $smtpmsg.To.Add($emailTo) $smtpmsg.Subject = "FIM Processing Error: " + $result.ReturnValue $smtpbody = "<!DOCTYPE html PUBLIC `"-//W3C//DTD XHTML 1.0 Strict//EN`" `"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd`">" $smtpbody += "<html xmlns=`"http://www.w3.org/1999/xhtml`"><head>" $smtpbody += "<title>FIM Processing Error</title></head><body>" $smtpbody += "<b>A Forefront Identity Manager</b> error has occured: " + $result.ReturnValue $smtpbody += "<br><b>MA Name</b>: " + $MA.Name $smtpbody += "<br><b>MA Run Profile</b>: " + $profileName $smtpbody += "<br><b>Start date & time</b>: " + $MA.RunStartTime().ReturnValue $smtpbody += "<br><b>End date & time</b>: " + $MA.RunEndTime().ReturnValue $smtpbody += "<br><b>Total connector space objects</b>: " + $MA.NumCSObjects().ReturnValue $smtpbody += "<br><b>Total Connectors</b>: " + $MA.NumTotalConnectors().ReturnValue $smtpbody += "<br><b>Connectors</b>: " + $MA.NumConnectors().ReturnValue $smtpbody += "<br><b>Explicit Connectors</b>: " + $MA.NumExplicitConnectors().ReturnValue $smtpbody += "<br><b>Total Disconnectors</b>: " + $MA.NumTotalDisconnectors().ReturnValue $smtpbody += "<br><b>Disconnectors</b>: " + $MA.NumDisconnectors().ReturnValue $smtpbody += "<br><b>Explicit Disconnectors</b>: " + $MA.NumExplicitDisconnectors().ReturnValue $smtpbody += "<br><b>Filtered Disconnectors</b>: " + $MA.NumFilteredDisconnectors().ReturnValue $smtpbody += "<br><b>Total Placeholders</b>: " + $MA.NumPlaceholders().ReturnValue $smtpbody += "<br><b>Import Add</b>: " + $MA.NumImportAdd().ReturnValue $smtpbody += "<br><b>Import Updates</b>: " + $MA.NumImportUpdate().ReturnValue $smtpbody += "<br><b>Import Deletes</b>: " + $MA.NumImportDelete().ReturnValue $smtpbody += "<br><b>Import No Change</b>: " + $MA.NumImportNoChange().ReturnValue $smtpbody += "<br><b>Export Add</b>: " + $MA.NumExportAdd().ReturnValue $smtpbody += "<br><b>Export Updates</b>: " + $MA.NumExportUpdate().ReturnValue $smtpbody += "<br><b>Export Deletes</b>: " + $MA.NumExportDelete().ReturnValue $smtpbody += "<br><br></body></html>" # Write-Output ( $smtpbody ) $smtpmsg.Body = $smtpbody $smtpmsg.IsBodyHTML = $true $RHFile = new-object Net.Mail.Attachment([string](get-location)+'\RunHistory.xml') $smtpmsg.Attachments.Add($RHFile) $EUFile = new-object Net.Mail.Attachment([string](get-location)+'\ErrorUsers.csv') $smtpmsg.Attachments.Add($EUFile) $smtp.Send($smtpmsg) $RHFile.Dispose() $EUFile.Dispose() } Write-Output (" -> "+$msg) Write-Output (" -> "+$result.ReturnValue) } } } } if(!$found) { Write-Output ("Not found MA type :"+$MATypeNRun.type); } } $continue = ($params_numOfExecs -EQ 0) -OR ($numOfExecDone -lt $params_numOfExecs) if($continue) { Write-Output-Banner("Sleeping "+$params_delayBetweenExecs+" seconds") Start-Sleep -s $params_delayBetweenExecs } } while($continue)
Free Windows Admin Tool Kit Click here and download it now
May 31st, 2010 10:59am

Hi, How do i get past this? PS C:\users\appfimda\desktop> get-wmiobject -class "MIIS_ManagementAgent" Get-WmiObject : Invalid class At line:1 char:14 + get-wmiobject <<<< -class "MIIS_ManagementAgent" I'm guessing i need to define some cmdlet or somethin?
September 21st, 2010 9:42am

Hi, first note the correct command is $MAs = @(get -wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $params_ComputerName) Then you obviously would need to the wmi class MIIS_ManagementAgent registred. Thus I am assuming installing MIIS synchronization server, formerly named FIM 2010 Sync server would be enough for this class to be registred. Cheers
Free Windows Admin Tool Kit Click here and download it now
September 21st, 2010 9:47am

I do something similar, and I'm attaching methods to the returned PSObject so that it's simpler to run profiles: # run a profile and print execution time and result function RunProfile ($agent,[string] $profileName) { $runStart = [System.DateTime]::UtcNow Write-Host -noNewLine "$($agent.Name) ${profileName} " $res = $agent.Execute($profileName) $runTime = [System.DateTime]::UtcNow - $runStart if ($res.ReturnValue -eq "success") { Write-Host "[$runTime] : $($res.ReturnValue)" } else { Write-Host -ForegroundColor Yellow "[$runTime] : $($res.ReturnValue)" } } # get an MA by name and attach functions to run profiles function ManagementAgent([string] $name) { $ma = get-wmiobject -class MIIS_ManagementAgent ` -namespace root\MicrosoftIdentityIntegrationServer ` -filter "name='$name'" -ErrorAction SilentlyContinue Add-Member -InputObject $ma ScriptMethod FullImport { RunProfile $this "Full Import" } Add-Member -InputObject $ma ScriptMethod FullSynch { RunProfile $this "Full Synch" } Add-Member -InputObject $ma ScriptMethod DeltaImport { RunProfile $this "Delta Import" } Add-Member -InputObject $ma ScriptMethod DeltaSynch { RunProfile $this "Delta Synch" } Add-Member -InputObject $ma ScriptMethod Export { RunProfile $this "Export" } Add-Member -InputObject $ma ScriptMethod Run { if ($args.Length -eq 0) { throw "Specify the name of the profile to run." } RunProfile $this $args[0] } $ma } # get the MA named "AD" $ad = ManagementAgent "AD" At this point, to run a profile from the PS shell you just need to type e.g. $ad.FullImport() and the best part is that if you hit tab you get auto-completion for the method name :) Paolo Tedesco - http://cern.ch/idm
September 21st, 2010 3:12pm

Hi, first note the correct command is $MAs = @(get -wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $params_ComputerName) Then you obviously would need to the wmi class MIIS_ManagementAgent registred. Thus I am assuming installing MIIS synchronization server, formerly named FIM 2010 Sync server would be enough for this class to be registred. Cheers Registrering the wmi class MIIS_ManagementAgent would be what i'm missing. Apparently it's not enough to install the FIM Sync server. I'll find out how to do that, and post i here, then maybe you could add it to the post?
Free Windows Admin Tool Kit Click here and download it now
September 23rd, 2010 10:22am

very useful info has anyboy managed to find a way to get past the Get-WmiObject : Invalid namespace At C:\Run Profiles\1-TEST-RUN-PROFILE.ps1:44 char:23 error. I'm quiet new in the scripting world and don't really know how to register the wmi class. ThanksThanks a mil, a mil, a mil
October 28th, 2010 10:09am

Hi....Can anyone help me to configure connector filter for MA using powershell script.... Thanks in advance.. Vijai Anand.R
Free Windows Admin Tool Kit Click here and download it now
January 5th, 2011 2:55am

Hi Vijai, that powershell script is only to ordonance management agents. I am not sure about what you are trying to perform, but I am assuming you would like to run a management agent tasks, and passing it a connector filter, right?Information Security Engineer
January 5th, 2011 7:24am

Hi Vijai, that powershell script is only to ordonance management agents. I am not sure about what you are trying to perform, but I am assuming you would like to run a management agent tasks, and passing it a connector filter, right?Information Security Engineer
Free Windows Admin Tool Kit Click here and download it now
January 5th, 2011 7:24am

Hello, i also made some modifications, one is to seperate the configuration into a XML file. also some other modifications. MyScript goes like this: <# .Synopsis Starts the FIM 2010 Management Agents in a sequence .Description Starting FIM 2010 Management Agents in a sequence based on a XML config file .Example FIMRunCycle -configfile config.xml Starts the RunCycle based on the specified config file. .Parameter configfile Specify the name of the XML config file .Notes NAME: FIMRunCycle AUTHOR: Author LASTEDIT: 01/06/2011 KEYWORDS: FIM 2010, Run Cycle, Management Agent #Requires -Version 2.0 #> param([string]$configfile=$(Read-Host -prompt "Configfile")) ### Load Configuration Data ### [xml]$maconfig=(Get-Content $configfile) "" > $maconfig.runcycle.logfile ### Functions ### $line = "---------------------------------------------------------------------------------" function Write-Output-Banner([string]$msg) { Write-Output $line,(" "+$msg),$line Write-Output $line,(" "+$msg),$line >> $maconfig.runcycle.logfile } function Write-Output-Text([string]$msg) { Write-Output $msg Write-Output $msg >> $maconfig.runcycle.logfile } ### Get Management Agent Data ### $allMA = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $maconfig.runcycle.computername) $numOfExecDone = 0 ### Main Script ### do { Write-Output-Banner("Execution #:"+(++$numOfExecDone)+" - Date: "+(date)) foreach($MANextRun in $maconfig.runcycle.ma) { $found = $false; foreach($MA in $allMA) { if(!$found) { if($MA.Name.Equals($MANextRun.name)) { $found=$true; Write-Output-Banner("MA: "+$MA.Name+" [Type: "+$MA.Type+"]") Write-Output-Text(" - Starting Pre-Script: "+$MANextRun.preScript) invoke-expression $MANextRun.preScript | Out-Null Write-Output-Text(" - Done`n") foreach($profileName in $MANextRun.profilesToRun) { Write-Output-Text(" - Starting Profile: "+$profileName) $datetimeBefore = Get-Date; $result = $MA.Execute($profileName); $datetimeAfter = Get-Date; $duration = $datetimeAfter - $datetimeBefore; Write-Output-Text(" - Done with status: "+$result.ReturnValue+" - Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds+"`n") } Write-Output-Text(" - Starting Post-Script: "+$MANextRun.postScript) invoke-expression $MANextRun.postScript | Out-Null Write-Output-Text(" - Done`n") Start-Sleep -s $MANextRun.waitSeconds } } } if(!$found) { Write-Output-Text("Not found MA name :"+$MANextRun.name); } } $continue = ($maconfig.runcycle.cycleWaitSeconds -EQ 0) -OR ($numOfExecDone -lt $maconfig.runcycle.numOfExecs) if($continue) { Write-Output-Banner("Sleeping "+$maconfig.runcycle.cycleWaitSeconds+" seconds") Start-Sleep -s $maconfig.runcycle.cycleWaitSeconds } } while($continue) and the XML config file is like this: <?xml version="1.0" encoding="utf-8" ?> <runcycle computerName="." cycleWaitSeconds="15" numOfExecs="1" logFile=".\runcycle.log"> <MA> <name>HR MA</name> <preScript>.\pre.cmd</preScript> <profilesToRun>FISO</profilesToRun> <profilesToRun>DS</profilesToRun> <postScript>.\post.cmd</postScript> <waitSeconds>5</waitSeconds> </MA> <MA> <name>FIM MA</name> <preScript>.\pre.bat</preScript> <profilesToRun>FISO</profilesToRun> <profilesToRun>DS</profilesToRun> <profilesToRun>E</profilesToRun> <profilesToRun>DISO</profilesToRun> <postScript>.\post.bat</postScript> <waitSeconds>5</waitSeconds> </MA> <MA> <name>AD MA</name> <preScript>cscript .\pre.vbs</preScript> <profilesToRun>E</profilesToRun> <profilesToRun>DISO</profilesToRun> <profilesToRun>DS</profilesToRun> <postScript>cscript .\post.vbs</postScript> <waitSeconds>5</waitSeconds> </MA> </runcycle> Greets Peter
January 6th, 2011 5:55am

Hello, i also made some modifications, one is to seperate the configuration into a XML file. also some other modifications. MyScript goes like this: <# .Synopsis Starts the FIM 2010 Management Agents in a sequence .Description Starting FIM 2010 Management Agents in a sequence based on a XML config file .Example FIMRunCycle -configfile config.xml Starts the RunCycle based on the specified config file. .Parameter configfile Specify the name of the XML config file .Notes NAME: FIMRunCycle AUTHOR: Author LASTEDIT: 01/06/2011 KEYWORDS: FIM 2010, Run Cycle, Management Agent #Requires -Version 2.0 #> param([string]$configfile=$(Read-Host -prompt "Configfile")) ### Load Configuration Data ### [xml]$maconfig=(Get-Content $configfile) "" > $maconfig.runcycle.logfile ### Functions ### $line = "---------------------------------------------------------------------------------" function Write-Output-Banner([string]$msg) { Write-Output $line,(" "+$msg),$line Write-Output $line,(" "+$msg),$line >> $maconfig.runcycle.logfile } function Write-Output-Text([string]$msg) { Write-Output $msg Write-Output $msg >> $maconfig.runcycle.logfile } ### Get Management Agent Data ### $allMA = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $maconfig.runcycle.computername) $numOfExecDone = 0 ### Main Script ### do { Write-Output-Banner("Execution #:"+(++$numOfExecDone)+" - Date: "+(date)) foreach($MANextRun in $maconfig.runcycle.ma) { $found = $false; foreach($MA in $allMA) { if(!$found) { if($MA.Name.Equals($MANextRun.name)) { $found=$true; Write-Output-Banner("MA: "+$MA.Name+" [Type: "+$MA.Type+"]") Write-Output-Text(" - Starting Pre-Script: "+$MANextRun.preScript) invoke-expression $MANextRun.preScript | Out-Null Write-Output-Text(" - Done`n") foreach($profileName in $MANextRun.profilesToRun) { Write-Output-Text(" - Starting Profile: "+$profileName) $datetimeBefore = Get-Date; $result = $MA.Execute($profileName); $datetimeAfter = Get-Date; $duration = $datetimeAfter - $datetimeBefore; Write-Output-Text(" - Done with status: "+$result.ReturnValue+" - Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds+"`n") } Write-Output-Text(" - Starting Post-Script: "+$MANextRun.postScript) invoke-expression $MANextRun.postScript | Out-Null Write-Output-Text(" - Done`n") Start-Sleep -s $MANextRun.waitSeconds } } } if(!$found) { Write-Output-Text("Not found MA name :"+$MANextRun.name); } } $continue = ($maconfig.runcycle.cycleWaitSeconds -EQ 0) -OR ($numOfExecDone -lt $maconfig.runcycle.numOfExecs) if($continue) { Write-Output-Banner("Sleeping "+$maconfig.runcycle.cycleWaitSeconds+" seconds") Start-Sleep -s $maconfig.runcycle.cycleWaitSeconds } } while($continue) and the XML config file is like this: <?xml version="1.0" encoding="utf-8" ?> <runcycle computerName="." cycleWaitSeconds="15" numOfExecs="1" logFile=".\runcycle.log"> <MA> <name>HR MA</name> <preScript>.\pre.cmd</preScript> <profilesToRun>FISO</profilesToRun> <profilesToRun>DS</profilesToRun> <postScript>.\post.cmd</postScript> <waitSeconds>5</waitSeconds> </MA> <MA> <name>FIM MA</name> <preScript>.\pre.bat</preScript> <profilesToRun>FISO</profilesToRun> <profilesToRun>DS</profilesToRun> <profilesToRun>E</profilesToRun> <profilesToRun>DISO</profilesToRun> <postScript>.\post.bat</postScript> <waitSeconds>5</waitSeconds> </MA> <MA> <name>AD MA</name> <preScript>cscript .\pre.vbs</preScript> <profilesToRun>E</profilesToRun> <profilesToRun>DISO</profilesToRun> <profilesToRun>DS</profilesToRun> <postScript>cscript .\post.vbs</postScript> <waitSeconds>5</waitSeconds> </MA> </runcycle> Greets Peter
Free Windows Admin Tool Kit Click here and download it now
January 6th, 2011 5:55am

very useful info has anyboy managed to find a way to get past the Get-WmiObject : Invalid namespace At C:\Run Profiles\1-TEST-RUN-PROFILE.ps1:44 char:23 error. I'm quiet new in the scripting world and don't really know how to register the wmi class. Thanks Thanks a mil, a mil, a mil I can run Paolo's script directly in the Powershell window all day long, but as soon as I add it as a Scheduled Task I get these WMI errors (once I remove the "SilentlyContinue" from the ErrorAction option). I'm not sure about what's different in my environment than what is in the Scheduled Task environment..... Any ideas on where to look for more information? I've been fighting this all day and I really don't want to have to revert to .vbs files and csript to run these jobs. ;) Get-WmiObject : Access denied At E:\Source\FIM Scripts\current\fim-test-script.ps1:131 char:21 + $ma = get-wmiobject <<<< -class MIIS_ManagementAgent ` + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], Managemen tException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C ommands.GetWmiObjectCommand
June 28th, 2011 2:55pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics