Quantcast
Channel: Directory Services forum
Viewing all articles
Browse latest Browse all 31638

Powershell script deleted AD objects

$
0
0

Hello

I am running AD 2003 native mode, all of my domain controllers are running Windows 2008 sp2. On one of my DC's I have installed powershell 2.0. What i am doing is trying to find a way to tell me when AD objects got deleted, so i found a cool script over at http://blogs.msdn.com/b/adpowershell/archive/2009/06/01/inspecting-deleted-objects-before-restore.aspx. I am running windows 7 i downloaded the script to my box. I also have the AD module for powershell on my machine. Below are the steps i took to try and get this to work.

#1 ran get-psdrive (listed  AD as one of the possible drives)

#2 CD AD: (changed to the AD drive

#3 from PS AD:\> c:\location-of-script\get-addeletedsontainers.ps1

When the script runs i the below error. According to the blog the script should work in a 2003 DFL and FFL. Again all my DC's are running 2008 with powershell 2.0

 

 

Cannot convert argument "1", with value: "", for "Replace" to type "System.Char
": "Cannot convert value "" to type "System.Char". Error: "String must be exact
ly one character long.""
At C:\saved\scripts\get-addeletedcontainers.ps1:25 char:53
+     $xmlObj = [xml]("<root>"+$xmlMetadataString.Replace <<<< ([char]0,"")+"</
root>")
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "1", with value: "", for "Replace" to type "System.Char
": "Cannot convert value "" to type "System.Char". Error: "String must be exact
ly one character long.""
At C:\saved\scripts\get-addeletedcontainers.ps1:38 char:53
+     $xmlObj = [xml]("<root>"+$xmlMetadataString.Replace <<<< ([char]0,"")+"</
root>")
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Cannot convert argument "1", with value: "", for "Replace" to type "System.Char
": "Cannot convert value "" to type "System.Char". Error: "String must be exact
ly one character long.""
At C:\saved\scripts\get-addeletedcontainers.ps1:51 char:53
+     $xmlObj = [xml]("<root>"+$xmlMetadataString.Replace <<<< ([char]0,"")+"</
root>")
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

 

 


Bulls on Parade

Viewing all articles
Browse latest Browse all 31638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>