Bulk removal of Published certificate info from users properties.


hello ,

 

i trying remove usercertificate , usersmimecertificate value users properties facing issue ....below script :::

 

  $users = get-content "c:\input.txt"  

                foreach($usersam in $users)

                {

                                $searcher = new-object directoryservices.directorysearcher

                                $root = [adsi]("ldap://" + "dc=guitar,dc=intra")

                                $scope = "subtree"

                                $filter = "(&(objectclass=user)(samaccountname=" + $usersam + "))"

                                $searcher.searchscope = $scope

                                $searcher.filter = $filter

                                $searcher.searchroot = $root

                                $accnt = $searcher.findone()

 

                                if($accnt -ne $null)

                                {

                                $userdn = $objuser.properties.distinguishedname

                                $user= new-object directoryservices.directoryentry ("ldap://kingfisher.guitar.intra:389/$userdn")

                                $user.putex(1,"usercertificate",0)

                                $user.putex(1,"usersmimecertificate",0)

                                $user.setinfo() 

 $userdn

                                }

                }

i getting following error :::

 

the following exception occurred while retrieving member "putex": "unknown error (0x80005000)"

at c:\users\administrator.win-b91istrf9uo\desktop\removeattribute.ps1:17 char:44

+                                 $user.putex <<<< (1,"usercertificate",0)

    + categoryinfo          : notspecified: (:) [], extendedtypesystemexception

    + fullyqualifiederrorid : catchfrombasegetmember

 

the following exception occurred while retrieving member "putex": "unknown error (0x80005000)"

at c:\users\administrator.win-b91istrf9uo\desktop\removeattribute.ps1:18 char:44

+                                 $user.putex <<<< (1,"usersmimecertificate",0)

    + categoryinfo          : notspecified: (:) [], extendedtypesystemexception

    + fullyqualifiederrorid : catchfrombasegetmember

 

the following exception occurred while retrieving member "setinfo": "unknown error (0x80005000)"

at c:\users\administrator.win-b91istrf9uo\desktop\removeattribute.ps1:19 char:46

+                                 $user.setinfo <<<< () 

    + categoryinfo          : notspecified: (:) [], extendedtypesystemexception

    + fullyqualifiederrorid : catchfrombasegetmember

 

the following exception occurred while retrieving member "pscomputername": "unknown error (0x80005000)"

    + categoryinfo          : notspecified: (:) [format-default], extendedtypesystemexception

    + fullyqualifiederrorid : catchfrombasegetmember,microsoft.powershell.commands.formatdefaultcommand

 

___________________________________________________________________________________________________________________________________________________________________________________________________________________________

ps c:\users\administrator.win-b91istrf9uo> c:\users\administrator.win-b91istrf9uo\desktop\removeattribute.ps1

the following exception occurred while retrieving member "putex": "unknown error (0x80005000)"

at c:\users\administrator.win-b91istrf9uo\desktop\removeattribute.ps1:17 char:45

+                                 $users.putex <<<< (1,"usercertificate",0)

    + categoryinfo          : notspecified: (:) [], extendedtypesystemexception

    + fullyqualifiederrorid : catchfrombasegetmember

 

the following exception occurred while retrieving member "putex": "unknown error (0x80005000)"

at c:\users\administrator.win-b91istrf9uo\desktop\removeattribute.ps1:18 char:45

+                                 $users.putex <<<< (1,"usersmimecertificate",0)

    + categoryinfo          : notspecified: (:) [], extendedtypesystemexception

    + fullyqualifiederrorid : catchfrombasegetmember

 

the following exception occurred while retrieving member "setinfo": "unknown error (0x80005000)"

at c:\users\administrator.win-b91istrf9uo\desktop\removeattribute.ps1:19 char:47

+                                 $users.setinfo <<<< () 

    + categoryinfo          : notspecified: (:) [], extendedtypesystemexception

    + fullyqualifiederrorid : catchfrombasegetmember

 

 

any is appreciated ...

 

 

thanks again.

resolved ...it silly mistake ... 1 want script ..please let me know .. 

 

:) :)

cheers , happy new year ...



Windows Server  >  Directory Services



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group