I need to get some double quotations around the GUID=$ntds output. I have tried encompassing the entire string in double quotes to no avail. Single quotes won't work because of the variable.
$Site=Read-Host "ENTER SITE NAME"
$Server=Read-Host "ENTER SERVER NAME"
$NTDS=Get-ADObject -Identity "CN=NTDS Settings,CN=$server,CN=Servers,CN=$site,CN=Sites,CN=Configuration,$((Get-ADDomain).DistinguishedName)" |foreach {$_.objectguid}
write-host "Repadmin /showobjmeta" * "<GUID=$ntds>"
You can use another pair of double quotes to escape like
Write-Host "hello ""200mg"""
Which will output hello "200mg"
Your case it would be
write-host "Repadmin /showobjmeta""<GUID=$ntds>"""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With