Using PowerShell to Fix an ObjectSID on a Portal object

Summary
Sometimes the ObjectSID just isn't what you want it to be or it's been unintentionally recalled due to another action. :)
This script should fix the portal object, just pass it the account name and domain on the command line and it will retrieve the SID, find the object by AccountName in the portal and then fix it if it is wrong.
Based on earlier examples by Joe Schulman and Markus Vilcinskas.
PARAM([string]$AccountName,[string]$Domain)
cls
set-variable -name URI -value "http://localhost:5725/resourcemanagementservice" -option constant
function GetSidAsBase64
PARAM($AccountName, $Domain)
END
$sidArray = [System.Convert]::FromBase64String("AQUAAAAAAAUVAAAA71I1JzEyxT2s9UYraQQAAA==") # This sid is a random value to allocate the byte array
$args = (,$Domain)
$args += $AccountName
$ntaccount = New-Object System.Security.Principal.NTAccount $args
$desiredSid = $ntaccount.Translate([System.Security.Principal.SecurityIdentifier])
write-host " -Account SID : ($Domain\$AccountName) $desiredSid"
$desiredSid.GetBinaryForm($sidArray,0)
$desiredSidString = [System.Convert]::ToBase64String($sidArray)
$desiredSidString
write-host "`nFix Account ObjectSID"
write-host "=========================="
#Retrieve the Base64 encoded SID for the referenced user
$accountSid = GetSidAsBase64 $AccountName $Domain
#Export the account configuration from the service:
write-host " -Reading Account information"
if(@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0)
{add-pssnapin FIMAutomation}
$exportObject = export-fimconfig -uri $URI `
-onlyBaseResources `
-customconfig ("/Person[AccountName='$AccountName']")
if($exportObject -eq $null) {throw "Cannot find an account by that name"}
$objectSID = $exportObject.ResourceManagementObject.ResourceManagementAttributes | `
Where-Object {$_.AttributeName -eq "ObjectSID"}
Write-Host " -New Value = $accountSid"
Write-Host " -Old Value =" $objectSID.Value
if($accountSid -eq $objectSID.Value)
Write-Host "Existing value is correct!"
else
$importChange = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportChange
$importChange.Operation = 1
$importChange.AttributeName = "ObjectSID"
$importChange.AttributeValue = $accountSid
$importChange.FullyResolved = 1
$importChange.Locale = "Invariant"
$importObject = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportObject
$importObject.ObjectType = $exportObject.ResourceManagementObject.ObjectType
$importObject.TargetObjectIdentifier = $exportObject.ResourceManagementObject.ObjectIdentifier
$importObject.SourceObjectIdentifier = $exportObject.ResourceManagementObject.ObjectIdentifier
$importObject.State = 1
$importObject.Changes = (,$importChange)
write-host " -Writing Account information ObjectSID = $accountSid"
$importObject | Import-FIMConfig -uri $URI -ErrorVariable Err -ErrorAction SilentlyContinue
if($Err){throw $Err}
Write-Host "Success!"
trap
Write-Host "`nError: $($_.Exception.Message)`n" -foregroundcolor white -backgroundcolor darkred
Exit
Go to the FIM ScriptBox

When i run the script i get the following:
Fix Account ObjectSID
==========================
 -Account SID : (mydomain\USERID) S-1-5-21-1314303383-2379350573-4036118543-289936
 -Reading Account information
 -New Value = AQUAAAAAAAUVAAAAl61WTi0C0o0PSJLwkGwEAA==
 -Old Value =
 -Writing Account information ObjectSID = AQUAAAAAAAUVAAAAl61WTi0C0o0PSJLwkGwEAA==
SourceObjectIdentifier : urn:uuid:63f7201a-3fc4-465a-a678-2f1f9fed73e7
TargetObjectIdentifier : urn:uuid:63f7201a-3fc4-465a-a678-2f1f9fed73e7
ObjectType             : Person
State                  : Put
Changes                : {ObjectSID}
AnchorPairs            :
Error: Failure when making web service call.
SourceObjectID = urn:uuid:63f7201a-3fc4-465a-a678-2f1f9fed73e7
Error = Microsoft.ResourceManagement.WebServices.Faults.ServiceFaultException: The request message contains errors that prevent processing the request.
   at Microsoft.ResourceManagement.WebServices.Client.UninitializedResource.PerformUpdate(String synchronizationSequenceIdentifier)
   at Microsoft.ResourceManagement.WebServices.Client.UninitializedResource.Update()
   at Microsoft.ResourceManagement.Automation.ImportConfig.UnifiedClientPut(List`1 changeList, UniqueIdentifier objectIdentifier, String objectType, CultureInfo locale)
   at Microsoft.ResourceManagement.Automation.ImportConfig.ProcessLocaleBucket(String objectIdentifier, String objectType, Dictionary`2 localeBucket)
   at Microsoft.ResourceManagement.Automation.ImportConfig.Put(String objectIdentifier, String objectType, List`1 changeList)
   at Microsoft.ResourceManagement.Automation.ImportConfig.EndProcessing()
Opper ...don't stop.

Similar Messages

  • Using Powershell to delete all users from the Portal

    Summary
    This script will delete all users from the Portal except for Administrator and the Built-In Sync account.
    Based on Markus's "Delete a User" script.
    Useful when developing your system if you want to quickly clear out the data and start again.
    set-variable -name URI -value "http://localhost:5725/resourcemanagementservice' " -option constant
    function DeleteObject
    PARAM($objectType, $objectId)
    END
    $importObject = New-Object Microsoft.ResourceManagement.Automation.ObjectModel.ImportObject
    $importObject.ObjectType = $objectType
    $importObject.TargetObjectIdentifier = $objectId
    $importObject.SourceObjectIdentifier = $objectId
    $importObject.State = 2
    $importObject | Import-FIMConfig -uri $URI
    if(@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {add-pssnapin FIMAutomation}
    $allobjects = export-fimconfig -uri $URI `
    –onlyBaseResources `
    -customconfig "/Person"
    $allobjects | Foreach-Object {
    $displayName = $_.ResourceManagementObject.ResourceManagementAttributes | `
    Where-Object {$_.AttributeName -eq "DisplayName"}
    if([string]::Compare($displayName.Value, "Administrator", $True) -eq 0)
    {write-host "Administrator NOT deleted"}
    elseif([string]::Compare($displayName.Value, "Built-in Synchronization Account", $True) -eq 0)
    {write-host "Built-in Synchronization Account NOT deleted"}
    else {
    $objectId = (($_.ResourceManagementObject.ObjectIdentifier).split(":"))[2]
    DeleteObject -objectType "Person" `
    -objectId $objectId
    write-host "`nObject deleted`n" $displayName.Value }
    Go to the FIM ScriptBox
    http://www.wapshere.com/missmiis

    The DeleteObject function opens and closes a connection for each object.  This approach is faster:
    http://social.technet.microsoft.com/wiki/contents/articles/23570.how-to-use-powershell-to-delete-fim-users-that-have-a-null-attribute-name.aspx
    Mike Crowley | MVP
    My Blog --
    Planet Technologies

  • Uploading document using Powershell is throwing error- There is no file with URL

    Hi.
    I am trying to upload multiple documents to a sub folder in a library using powershell.
    I am getting the error as : ForEach-Object : Exception calling "Add" with "3" argument(s):
    "<nativehr>0x80070003</nativehr><nativestack></nativestack>There is no file
    with URL 'server/TestLibrary/User_image/ab_3f_wht_ist_small_gif.gif' in this Web."
    I have used the below code:
    function UploadImages($weburl)
    $docLibraryName = "TestLibrary"
    $localFolderPath = "C:\Users\Imgs\user_image"
    Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
    $web = Get-SPWeb -Identity $webUrl
    $docLibrary = $web.Lists[$docLibraryName]
    $subFolderName="user_image"
    Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
    $web = Get-SPWeb -Identity $webUrl
    $docLibrary = $web.Lists[$docLibraryName]
    #Attach to local folder and enumerate through all files
    $files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles() | ForEach-Object {
    #Create file stream object from file
    $fileStream = ([System.IO.FileInfo] (Get-Item $_.FullName)).OpenRead()
    $contents = new-object byte[] $fileStream.Length
    $fileStream.Read($contents, 0, [int]$fileStream.Length);
    $fileStream.Close();
    write-host "Copying" $_.Name "to" $docLibrary.Title "in" $web.Title "..."
    #Add file
    $folder = $web.getfolder($docLibrary.Title + "/" + $subFolderName)
    write-host "folder is " $folder
    $spFile = $folder.Files.Add($folder.Url + "/" + $_.Name, $contents, $true)
    $spItem = $spFile.Item
    Write-Host -f Green "Added Images to Library !!!"
    $web.Dispose()
    How to fix this?
    Thanks

    HI,
    Is the name of the image or the sub folder name the issue?
    I have the images with the name as "ab_3f_wht_ist_small_gif.gif".  folder name "User_image"
    There are underscores on the file name, but there is no space. When I add the file from the library (using the UI), the image is getting added.
    But adding through the powershell is giving the issue.
    I have checked this:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e810ad03-81ef-4fa6-aab8-ddc896a13ebf/getting-error-during-uploading-a-document-using-powershell?forum=sharepointdevelopmentprevious
    but did not help.
    Thanks

  • Using Powershell (or console) to find all objects in maintenance mode?

    Hi,
    I have stumbled across the fact that aside from a handful of servers that have been put into pretty much unlimited MM rather than fix them a previous admin has put loads of individual objects such as disk drives, network cards etc. in long MM.
    I am trying work out an easy way of seeing the server associated with the actual disk, card etc.. I am using -
    Get-SCOMMonitoringObject | where-object {$_.InMaintenanceMode -eq $true}
    This does list everything such as -
    Success                True        C:                                        
    Uninitialized          True        Local Area Connection                     
    Uninitialized          True        Memory
    but I am not sure how I then link that to an actual server so I can take it out of MM?
    I am guessing I could use PowerShell to take all monitors out of MM for instance but dont really want to do that
    thanks!

    Hi,
    More details about command Get-SCOMMaintenanceMode:
    http://technet.microsoft.com/en-us/library/hh920235(v=sc.20).aspx
    Regards,
    Yan Li
    Regards, Yan Li

  • FSRM report limits using PowerShell

    I am following this article:
    http://blogs.technet.com/b/filecab/archive/2014/05/20/set-fsrm-storage-report-limits-using-powershell.aspx
    I did have this working just fine, but after installing Windows Updates today on a 2012 R2 box this functionality breaks the GUI. Now, any time you try to edit a report you are hit with Event ID 0, 'file server resource manager value is not valid' and a
    GUI error of 'Unexpected Error. Value of 1000 is not valid for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'.
    The report still runs, but you cannot view in the GUI until you again use PowerShell to decrease the limits back to default.
    Any ideas on how to fix? (Other than removing the updates) Seems a recent Windows Update has broken this.

    The Windows Update version is the latest available. So if you have a 2012 R2 server and install every available update, that's the level I'm at. It was a recent update that seems to have broken this, I just don't know which one.
    The parameter was already set to 1,000 and was working fine. The default is 100, and any value greater than 100 now produces the GUI error.
    Newly created reports also produce the same error. I stress that the reports do still run with the value of 1,000 set by PowerShell, it's just the GUI that does not recognise the values set by PowerShell.
    Looks like a bug in a recent Windows Update.

  • Want to extract the data using powershell script.

    [Jul 21 15:01:47] INFO  (Fixmethod.java:1998) - UNABLE TO CONNECT TO FIX SERVER ATTEMPT NO:3 - logConsoleMsg
    I want to retrieve [Jul 21 15:01:47] from line above  into a variable. using powershell.
    How can it be done.
    Thanks in Advance.

    I tried "a.substring(1,15)", and it is working fine. :)
    Just be aware that it may not always work the way you expect it to. What happens when you only need 14 characters instead of 15?
    [Jul 1 15:01:47] instead of [Jul 21 15:01:47].
    This, of course, assumes that the dates aren't presented like so: [Jul 01 15:01:47]. If that's the case, you can just ignore this post.
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • Creating look up column using powershell.

    I have a Sharepoint list "Studentparent" in my website. I am trying to create a custom list "studentchild" list using powershell code and this studentchild list will be having a look up column getting ID column from "StudentParent"
    list - So the code is 
    #To which site u want to create the list 
    $spWeb=Get-SPWeb -Identity http://XYZ
    #List type or template 
    $spTemplate = $spWeb.ListTemplates["Custom List"]
    #Get all the lists to the listcollection
    $spListCollection=$spWeb.Lists
    #adding the new list to the list collection
    $spListCollection.Add("StudentChild","StudentChild",$spTemplate)
    #get the path of subsite and sitecollecion 
    $path = $spWeb.url.trim()
    #get the list to the list object
    $spList = $spWeb.GetList("$path/Lists/StudentChild")
    $ParentList = $spWeb.Lists.item("StudentParent")
    $spList = $WebObj.Lists["StudentChild"]
    $spList.Fields.AddLookup("ChildLookupField",$ParentList.id,$false)
    $spChildListLookupField = $spList.Fields["ChildLookupField"]
    $spChildListLookupField.LookupField = $ParentList.Fields["ID"]
    $spChildListLookupField.RelationshipDeleteBehavior = [Microsoft.SharePoint.SPRelationshipDeleteBehavior]::Restrict
    $spChildListLookupField.Update()
    $Views = $spList.Views["All Items"]
    $Views.ViewFields.Add("ChildLookupField")
    $Views.Update()
    but when i run this code - I am getting error
    Cannot index into a null array.
    + $spList = $WebObj.Lists["StudentChild"]

    Hi Mahesh,
    The object "$WebObj" is not instantiated in your code. You have already assigned the value to $splist in following line.
    $spList = $spWeb.GetList("$path/Lists/StudentChild")
    and once again you are assigning value
    $spList = $WebObj.Lists["StudentChild"] // redundant and it should be $spWeb.Lists["StudentChild"]
    Please let us know if this fixes your issue.
    Thanks,
    M. Gubendra Raj

  • Install multiple hotfixes using powershell

    Guys,
    I need help in  installing multiple hot fixes  using powershell on our domain controllers. i searched a little on google/bing  but was unable to find  the solution may be i am searching wrong :) . The solution should install  multiple
    hotfixes  and don't restart . restart can be done manually. 

    My understanding is most Microsoft hotfixes should use the
    Windows Installer Tool (msiinstaller). If you have a list of hotfixes to deploy you could put them all in a folder and have your script run each of them. 
    If you run the hotfix in quiet mode (/q[n|b|r|f]), it looks like it
    returns error code 3010 to indicate a reboot is required but doesn't reboot the machine (see also on TechNet List of error codes and error messages for Windows Installer processes in Office 2003
    products and Office XP products which should apply to most hotfixes that use the Windows Installer Tool).
    You could track each hotfix for this error and if it's returned use
    Restart-Computer to restart the machine only once completed.
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • Using Powershell Script Run simple query in MS Access 2007 and export the results of query to Excel

    Hi Experts,
    I have a Access 2007 DB file and 2 Big tables inside that (bigger than the size that can be easily handled by MS Excel 2007).
    My requirement is automate using powershell scripts the below things.
    1. Create a SQL query in Access DB and save that in access DB
    2. Run the saved query and export the result in excel sheet where I can create the charts and Pivots. Thanks in advance
    Prajesh

    Do you have to use the Access query, couldn't you just recreate the query in Powershell?  Here's a link with good info that references an existing script for querying an Access database:
    http://blogs.technet.com/b/heyscriptingguy/archive/2009/08/13/hey-scripting-guy-can-i-query-a-microsoft-access-database-with-a-windows-powershell-script.aspx
    Once you have your dataset you can pipe it to
    Export-Csv -NoType c:\pathtofile\output.csv

  • Create SharePoint 2010 Search Service Application Using Powershell

    Hi Team,
    Could you please assist me in completing the search service application for
    two server using powershell. Both the servers will be running all the component
    Version SharePoint 2010
    # 1.Setting up some initial variables.
    write-host 1.Setting up some initial variables.
    $SSAName = "Search Service Application"
    $SVCAcct = "Domain\ServiceAccount"
    $SearchAppPoolName ="DefaultAppPool"
    $SSI = get-spenterprisesearchserviceinstance -local
    $err = $null
    $SSADBName="Search_AdminDB"
    $SSADBServer="DBServer"
    $host1="Server1"
    $host2="Server2"
    # Start Services search services for SSI
    write-host Start Services search services for SSI
    Start-SPEnterpriseSearchServiceInstance -Identity $SSI
    # 2.Create an Application Pool.
    write-host 2.Create an Application Pool.
    #$AppPool = new-SPServiceApplicationPool -name $SSAName"-AppPool" -account $SVCAcct
    $AppPool = Get-SPServiceApplicationPool -Identity $SearchAppPoolName -ErrorAction SilentlyContinue
    # 3.Create the SearchApplication and set it to a variable
    write-host 3.Create the SearchApplication and set it to a variable
    $SearchApp = New-SPEnterpriseSearchServiceApplication -DatabaseServer $SSADBServer -Name $SSAName -applicationpool $AppPool -databasename $SSADBName
    #4 Create search service application proxy
    write-host 4 Create search service application proxy
    $SSAProxy = new-spenterprisesearchserviceapplicationproxy -name $SSAName"ApplicationProxy" -Uri $SearchApp.Uri.AbsoluteURI
    # 5.Provision Search Admin Component.
    write-host 5.Provision Search Admin Component.
    set-SPenterprisesearchadministrationcomponent -searchapplication $SearchApp -searchserviceinstance $SSI
    # 6.Create a new Crawl Topology.
    write-host 6.Create a new Crawl Topology.
    $CrawlTopo = $SearchApp | New-SPEnterpriseSearchCrawlTopology
    New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
    Source:blog.MSDN Author- Russ Maxwell
    Thanks Basva

    Could you please assist me in completing the search service application for
    two server using powershell. Both the servers will be running all the component 
    Hi Basva,
    Do you want to provision two search service applications in single farm?
    Commonly, only one search service application is needed in a farm for Search function.
    Here are articles for detail information about how to provision search service application using powershell:
    http://blogs.msdn.com/b/jjameson/archive/2011/02/28/powershell-script-to-configure-search-in-sharepoint-server-2010.aspx
    http://blogs.msdn.com/b/russmax/archive/2009/10/20/sharepoint-2010-configuring-search-service-application-using-powershell.aspx
    Regards,
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365

    not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365?
    Any idea?

    after few days test in my lab, I can see that only email enabled group can be added as site collection admin using POWERSHELL.
    hope this helps who stuck like me!! :-)

  • Changing a SQL Report server Database to a new One Using Powershell script

    Hi,
    I have an existing report server (Native Mode) and a pre-configured report server database. I have created a new database and want to assign it new report server database. How can i automate this process using powershell?
    Here is the detail requirement
    If there is a Report Server database seeded on the xxxxx server, follow the below steps:
    ◾Click the Database button on the left. Click on the Change Database button, choose option Choose an existing report server database. Enter the RPT server name (e.g. xxxxxx) in Server Name text box and click Next.
    ◾In the Report Server Database selection, select the ReportServer database. Then click next button to complete the process.
    Any help in this regard will be very much helpfull.
    Sushruta Banerjee

    Hi Sushruta,
    To query export from Report server Database, the scripts below may be helpful for you:
    Export RDL Files from ReportServer Database with PowerShell
    SQL Database Reports with PowerShell
    I hope this helps.

  • Automation of SPLA Report using PowerShell

    Hi,
    I am reposting this question in this forum on the suggestion of an experienced exchange mvp, earlied posted in Exchange 2013 forum.
    We want to automate SPLA report creation using PowerShell for Exchange 2010 and 2013, I mean
    the report for Microsoft Service Providers License Agreement Program, which Service providers have to generate every month and have to submit to Microsoft.
    Can somebody guide us, as we could not find any helpful online resource.
    Thanks in anticipation.
    Regards, David Johnson

    That reads like a hosting question to me, and hosters know best about that.  If I were a moderator, I'd move this thread for you, but I'm not so I recommend you post in the Exchange for Hosters forum:
    http://social.technet.microsoft.com/Forums/en-US/exchange2010hosters/threads
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • Creating a Scheduled Task using PowerShell v4

    So here is my question.  I'm trying/wanting to create a scheduled task using PowerShell v4 on Server 2012R2.  I want to task to run on the 1st day of every month.  The parameter for -Monthly -Day is not available.  I need to use PowerShell
    to create the Scheduled Task because the Task will be running with a group Managed Service Account credentials so the Scheduled Task can not be created via the Task Scheduler GUI.
    Thanks in Advance

    Here is a functioning task It can be easily edited in PowerShell or in notepad to alter the timing
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.1" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
    <RegistrationInfo>
    <Author>W8TEST\user01</Author>
    </RegistrationInfo>
    <Triggers>
    <CalendarTrigger>
    <StartBoundary>2014-06-04T21:31:32.0459499</StartBoundary>
    <Enabled>true</Enabled>
    <ScheduleByMonth>
    <DaysOfMonth>
    <Day>1</Day>
    <Day>12</Day>
    <Day>24</Day>
    </DaysOfMonth>
    <Months>
    <January />
    <February />
    <March />
    <April />
    <May />
    <June />
    <July />
    <August /
    <September />
    <October />
    <November />
    <December />
    </Months>
    </ScheduleByMonth>
    </CalendarTrigger>
    </Triggers>
    <Principals>
    <Principal id="Author">
    <RunLevel>LeastPrivilege</RunLevel>
    <UserId>W8TEST\jvierra</UserId>
    <LogonType>InteractiveToken</LogonType>
    </Principal>
    </Principals>
    <Settings>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <IdleSettings>
    <StopOnIdleEnd>true</StopOnIdleEnd>
    <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
    </Settings>
    <Actions Context="Author">
    <Exec>
    <Command>notepad.exe</Command>
    <Arguments>test.txt</Arguments>
    <WorkingDirectory>c:\temp</WorkingDirectory>
    </Exec>
    </Actions>
    </Task>
    I have edited and reloaded the XML many, many times.  It works very nicely.
    ¯\_(ツ)_/¯

  • How to add a certificate to IIS global "Server Certificates" list using PowerShell?

    Hi, been surfing the web for an example on how to add a certificate to the "global" IIS "Server Certificates" list using PowerShell but to no luck. I already have code in place on how to tie / associate a specific website with a specific cert but not how
    to add the new .cer file using the "Complete Certificate Request..." wizard using PowerShell.... I dont expect the final code to become published but if someone had an idea on howto integrate / get an entry point on where to interact between the "Server Certificate"
    list in IIS and POSH I would be super happy! :|
    I am runnign IIS on a Windows 2008R2 x64 Standard Edition if that helps..... of course, I would saddle for an CLI if there is no other way, but POSH is of course the way to go! :)
    Thanks for the help in advance guys, take care!
    br4tt3

    Hi and thanks for the suggestions!
    Although it comes close, the suggested code example points on howto import / incorporate .pfx files - I am getting fed by .cer files which I need to add into the IIS console using POSH.
    I tried explore the IIS.CertObj object but was not able to work out if this one could be used for importing / adding .cer files into IIS! However, launching the following command from a POSH console with Import-Module Webadministration already
    loaded into that shell;
    $certMgr = New-Object -ComObject IIS.CertObj returns the following error message:
    New-Object : Cannot load COM type IIS.CertObj
    From an IIS perspective I have the following components installed;
    [X] Web Server (IIS)                                    Web-Server
        [X] Web Server                                      Web-WebServer
            [ ] Common HTTP Features                        Web-Common-Http
                [ ] Static Content                          Web-Static-Content
                [ ] Default Document                        Web-Default-Doc
                [ ] Directory Browsing                      Web-Dir-Browsing
                [ ] HTTP Errors                             Web-Http-Errors
                [ ] HTTP Redirection                        Web-Http-Redirect
                [ ] WebDAV Publishing                       Web-DAV-Publishing
            [X] Application Development                     Web-App-Dev
                [ ] ASP.NET                                
    Web-Asp-Net
                [X] .NET Extensibility                      Web-Net-Ext
                [ ] ASP                                    
    Web-ASP
                [ ] CGI                                    
    Web-CGI
                [ ] ISAPI Extensions                        Web-ISAPI-Ext
                [ ] ISAPI Filters                           Web-ISAPI-Filter
                [ ] Server Side Includes                    Web-Includes
            [ ] Health and Diagnostics                      Web-Health
                [ ] HTTP Logging                            Web-Http-Logging
                [ ] Logging Tools                           Web-Log-Libraries
                [ ] Request Monitor                         Web-Request-Monitor
                [ ] Tracing                                
    Web-Http-Tracing
                [ ] Custom Logging                          Web-Custom-Logging
                [ ] ODBC Logging                            Web-ODBC-Logging
            [X] Security                                   
    Web-Security
                [ ] Basic Authentication                    Web-Basic-Auth
                [ ] Windows Authentication                  Web-Windows-Auth
                [ ] Digest Authentication                   Web-Digest-Auth
                [ ] Client Certificate Mapping Authentic... Web-Client-Auth
                [ ] IIS Client Certificate Mapping Authe... Web-Cert-Auth
                [ ] URL Authorization                       Web-Url-Auth
                [X] Request Filtering                       Web-Filtering
                [ ] IP and Domain Restrictions              Web-IP-Security
            [ ] Performance                                 Web-Performance
                [ ] Static Content Compression              Web-Stat-Compression
                [ ] Dynamic Content Compression             Web-Dyn-Compression
        [X] Management Tools                                Web-Mgmt-Tools
            [X] IIS Management Console                      Web-Mgmt-Console
            [X] IIS Management Scripts and Tools            Web-Scripting-Tools
            [ ] Management Service                          Web-Mgmt-Service
            [ ] IIS 6 Management Compatibility              Web-Mgmt-Compat
                [ ] IIS 6 Metabase Compatibility            Web-Metabase
                [ ] IIS 6 WMI Compatibility                 Web-WMI
                [ ] IIS 6 Scripting Tools                   Web-Lgcy-Scripting
                [ ] IIS 6 Management Console                Web-Lgcy-Mgmt-Console
        [X] FTP Server                                      Web-Ftp-Server
            [X] FTP Service                                 Web-Ftp-Service
            [X] FTP Extensibility                           Web-Ftp-Ext
        [ ] IIS Hostable Web Core                           Web-WHC
    More or less the one thing that I am trying to get up and running is an automated FTPS solution - I just use the IIS console to be able to troubleshoot / compare how things scripted from POSH interacts in the MMC representation. The error I am getting
    might be that I am lacking some IIS components to be in place to be able to automate some parts of the IIS - as suggested by the IIS.CertObj object listed in the example..... I will get back if I can track down which component needs to be added to be
    able to reference the IIS.CertObj object.
    Br4tt3 signing out...
    br4tt3

Maybe you are looking for