<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[zekial.io]]></title><description><![CDATA[the personal blog of zeke ross]]></description><link>https://zekial.io/</link><image><url>https://zekial.io/favicon.png</url><title>zekial.io</title><link>https://zekial.io/</link></image><generator>Ghost 5.28</generator><lastBuildDate>Wed, 22 Apr 2026 10:47:27 GMT</lastBuildDate><atom:link href="https://zekial.io/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Computer Recovery from Active Directory Deleted Objects]]></title><description><![CDATA[A quick guide on reviving computers from the AD Recycle Bin/Deleted Objects]]></description><link>https://zekial.io/computer-recovery-from-active-directory-deleted-objects/</link><guid isPermaLink="false">64f254162b02a13be1378481</guid><category><![CDATA[War Stories]]></category><dc:creator><![CDATA[Zeke Ross]]></dc:creator><pubDate>Fri, 01 Sep 2023 22:38:56 GMT</pubDate><media:content url="https://zekial.io/content/images/2023/09/stone-age-computer-computer-monument-concrete-calculator.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://zekial.io/content/images/2023/09/stone-age-computer-computer-monument-concrete-calculator.jpg" alt="Computer Recovery from Active Directory Deleted Objects"><p>First, some background as to how we got to this point. At the company I work for, we had a problem. Our Active Directory environment was full of computer accounts that belonged to PCs that had been retired/recycled. This was because the arrangement we had with our sub-companies made it so that they handled the implementation and removal of computer hardware themselves, we just provided them the hardware and operating system image. As a result, there was no real deprovisioning process and the sites dumped the hard drives into a shredder without ever removing them from the domain, leaving thousands of orphaned computer accounts to clutter our AD. As a solution, it was decided to run a script daily that checked to see if each computer had been logged into for the last 30 days, and if it wasn&apos;t the PC would be disabled. If it hadn&apos;t been logged into for 90 then the PC account would just be deleted from our AD. Problem solved, right?</p><p>Well, not quite. See, we run healthcare facilities, and as a result they cannot be with the downtime losing a PC results in, so to hedge against that they purchased two PCs for every one they needed. Therefore, they had a good stock of computers in a closet in case one died for a quick swap out. Issue was, our script deleted the PC objects related to those computers, and as a result nobody could log in as the PC no longer had a trust relationship without it&apos;s computer account. IT techies couldn&apos;t get in either, as there was no way to get the local admin password as the LAPS attribute wasn&apos;t saved anywhere (in retrospect, the script should have saved the LAPS password somewhere before deleting it). So the only option for saving these was a reimage, which (due to a large amount of complexities I won&apos;t get into) is a very time consuming and expensive process.</p><p>End result? Lots of tickets, close to 100, about PCs pulled from closets that couldn&apos;t be logged into. And yea, that&apos;s a lot of UPS labels. So I decided we needed to make use of the AD Recycle Bin. Luckily, it was enabled on our domain and just wasn&apos;t configured correctly for most admins. When this feature is enabled, every time someone deletes a computer object from Active Directory it isn&apos;t deleted, just moved to a new container called &quot;Deleted Objects&quot; in a process called &quot;tombstoning&quot;. The resulting &quot;tombstone&quot; object contains most of the properties of the original, and as such can be brought back by a domain administrator. Issue is, it&apos;s very unlikely that the person dealing with the calls about these computers is a domain admin, so we need to allow other people to look into the folder. &#xA0;</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://zekial.io/content/images/2023/09/image.png" class="kg-image" alt="Computer Recovery from Active Directory Deleted Objects" loading="lazy" width="1119" height="130" srcset="https://zekial.io/content/images/size/w600/2023/09/image.png 600w, https://zekial.io/content/images/size/w1000/2023/09/image.png 1000w, https://zekial.io/content/images/2023/09/image.png 1119w" sizes="(min-width: 720px) 720px"><figcaption>Very fancy container</figcaption></figure><p>Doing this isn&apos;t super hard, just it requires a bit of set up in regards to the permissions people are given over this object. Essentially, in order to interact with it as a normal admin, you need to have the same perms as a domain admin would over &quot;Deleted Objects&quot;. Also, you need the &quot;reanimate tombstones&quot; permission on the root Active Directory domain in order to bring them back to life. Microsoft <a href="https://learn.microsoft.com/en-us/troubleshoot/windows-server/identity/non-administrators-view-deleted-object-container">has a guide on how to do this</a>, but I find that it&apos;s missing a couple of permissions and through trial and error and some old forum threads found the correct perms needed.</p><p>Here are the permissions you need to grant to use this tool completely (Can be done on an individual basis, but I would recommend assigning to a security group): </p><!--kg-card-begin: markdown--><pre><code>dsacls &quot;dc=fmc,dc=inc&quot; /g &quot;fmcinc\groupname:ca;Reanimate Tombstones&quot;
dsacls &quot;cn=deleted objects,dc=fmc,dc=inc&quot; /g fmcinc\groupname:SDRPWOCCDCLCWSWPRC
</code></pre>
<!--kg-card-end: markdown--><p>This must naturally be run on the DC by a domain admin. Do note that, while maybe not the most sensitive perms in the world, this could result in admins gaining access to sensitive deleted computer accounts. I&apos;m not sure how much of a threat that is in the real world, but in my research I found at least one CTF that required it&apos;s abuse. Don&apos;t run random commands on your DC because some random in a blog told you it might work. Make sure you know what you&apos;re giving out (and in this case it&apos;s almost everything in this OU).</p><p>Once these permissions were granted, a new problem arose. I will not keep my love of Active Directory Administrative Center (ADAC) a secret, but in this case my trust appears to have been misplaced. See, we use Azure Active Directory Connect to sync our domain to Entra ID (or whatever they call it now). This results in a load of junk &quot;deleted objects&quot; being created for azure-enabled security groups and mailboxes every time the sync runs. This on top of PCs recreating their printer maps (which leads to junk entries being sent to deleted objects). ADAC can only display up to 100,000 entries at once, and in an org as large as ours that just isn&apos;t enough. After a struggle, you will just get an error and it will give up.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://zekial.io/content/images/2023/09/image-1.png" class="kg-image" alt="Computer Recovery from Active Directory Deleted Objects" loading="lazy" width="953" height="823" srcset="https://zekial.io/content/images/size/w600/2023/09/image-1.png 600w, https://zekial.io/content/images/2023/09/image-1.png 953w" sizes="(min-width: 720px) 720px"><figcaption>The default shown here is 20,000, but even at the max value it still isn&apos;t enough for our enviroment</figcaption></figure><p>This is a slight problem, but not an insurmountable one. We could use the LDAP UI, but that&apos;s not super fun to work with. The better option is to just use the AD PowerShell module to do the heavy lifting for us. </p><p>The command that I&apos;m going to use is this:</p><pre><code class="language-PowerShell">Get-ADObject -Filter {((ObjectClass -eq &quot;Computer&quot;) -and (isDeleted -eq &quot;TRUE&quot;)) -and (Name -like &quot;*pcname*&quot;)} -IncludeDeletedObjects -Properties * | Format-List Name, LastKnownParent, Modified, objectSID, ms-Mcs-AdmPwd</code></pre><p>Lets go into it how it works for the PowerShell-uninitiated (so if you want to customize it you can). <code>Get-ADObject</code> does exactly what it sounds like. We are just grabbing something from AD. Next, we need to filter it down to what we need. </p><p>First, I check to make sure it&apos;s a computer (I don&apos;t need users although it&apos;s unlikely they will appear anyways), and also that it&apos;s actually deleted (I don&apos;t want to run anything against a normal AD account). As such, <code>(ObjectClass -eq &quot;Computer&quot;) -and (isDeleted -eq &quot;TRUE&quot;)</code> will check that for us. If both of those are true, I also only want the PC with the name I want back. As such, we&apos;ll add another filter <code>(Name -like &quot;*pcname*&quot;)</code>. Note the asterisks, I don&apos;t actually know what the PC name is a lot of the time but our provisioning script appends the serial number of the PC to the name, so I&apos;m just telling it to look for a PC with that number included somewhere in the name but I don&apos;t require it to be exact. At a minimum you will need the right-side asterisk because all deleted object names are appended with <code>`nDEL:&lt;id&gt;</code> and there is absolutely zero way for us to know what that ID is beforehand (not that we need to). </p><p>Finally, we need to tell it to look for deleted things, so add <code>-IncludeDeletedObjects</code> and also pull every property, add <code>-Properties *</code>. I then pipe that output into a formatted list to give me the PC name, what OU it used to live in, when it was deleted, what it&apos;s SID was, and what the LAPS password was (just in case I can&apos;t restore it for some reason). Result looks something like this:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://zekial.io/content/images/2023/09/image-4.png" class="kg-image" alt="Computer Recovery from Active Directory Deleted Objects" loading="lazy" width="2000" height="1093" srcset="https://zekial.io/content/images/size/w600/2023/09/image-4.png 600w, https://zekial.io/content/images/size/w1000/2023/09/image-4.png 1000w, https://zekial.io/content/images/size/w1600/2023/09/image-4.png 1600w, https://zekial.io/content/images/2023/09/image-4.png 2350w" sizes="(min-width: 720px) 720px"><figcaption>Very deleted</figcaption></figure><p>That&apos;s great, but how do we play necromancer and bring it back to life? Well, we can just repeat that search again but instead of piping <code>Format-List</code> in we will instead pipe in <code>Restore-ADObject</code>. Also, for good measure lets add the <code>-TargetPath</code> parameter and tell it where it&apos;s supposed to go as our wayward script moved everything into a &quot;disabled&quot; OU before it deleted it. &#xA0;</p><p>Let&apos;s see it:</p><pre><code class="language-PowerShell">Get-ADObject -Filter {((ObjectClass -eq &quot;Computer&quot;) -and (isDeleted -eq &quot;TRUE&quot;)) -and (Name -like &quot;*pcname*&quot;)} -IncludeDeletedObjects | Restore-ADObject -TargetPath &quot;OU=Computers,OU=Your,OU=Site,OU=Here,DC=Contoso,DC=INC&quot;</code></pre><p>And just like that, our PC is back from the grave! That being said, if you remember from my background info the PC was disabled first before being deleted, and as our restored object shares all the same properties as before it was deleted, it&apos;s still going to be disabled. We could try and run our search again and pipe something else in, but we can&apos;t as the tombstone object we were working with has dissapeared! It was deleted when we restored it, so we need to run another search to find it again. </p><p>This one is easy tho, same principal as last time, just with only the name as a filter. </p><pre><code class="language-PowerShell">Get-ADObject -Filter {Name -Like &quot;stb-5cg032810j&quot;} | Enable-ADAccount</code></pre><p>And just like that (and after 30 or so minutes for it to replicate to all DCs), we are back! Downside tho, we have dozens of these left to do and running three commands forever is gonna get old fast. Let&apos;s take all these concepts and make a script. </p><pre><code class="language-PowerShell">param ($TargetCN, $pcName)
$pcSearchTerm = &quot;*&quot; + $pcName + &quot;*&quot;  
#Checked deleted objects folder for deleted computer objects matching search term  
$deletedPC = Get-ADObject -Filter {((ObjectClass -eq &quot;Computer&quot;) -and (isDeleted -eq &quot;TRUE&quot;)) -and (Name -like $pcSearchTerm)} -IncludeDeletedObjects -Properties *  
#Lists some info about PC  
$deletedPC | Format-List Name, LastKnownParent, Modified, objectSID, ms-Mcs-AdmPwd  
#Attempts to restore object  
try { $deletedPC | Restore-ADObject -TargetPath $TargetCN}
catch{&quot;PC couldn&apos;t be reanimated&quot;}

$revivedPC = Get-ADObject -Filter {Name -like $pcSearchTerm}
try{$revivedPC | Enable-ADAccount}
catch{&quot;Could not re-enable AD Computer Account.&quot;}</code></pre><p>This is pretty quick and dirty (I don&apos;t need every property lol), and the error handling is really not where it needs to be, but this will let me plug and chug a name and bring it back. </p><p>Hope this was helpful in some way to you and/or saved you a little more Google searching. Thanks for sticking with me!</p><p>~Zeke</p>]]></content:encoded></item><item><title><![CDATA[Where and How to Use the Accessory Port on a 2017+ BMW G310 GS]]></title><description><![CDATA[<p>So you want to add a 12 volt accessory, say a GPS or a USB charger for your cell phone or Cardo or something to your G310 GS. You could just wire it straight off the battery, but then every time you turn the bike off you need to go</p>]]></description><link>https://zekial.io/where-and-how-to-use-the-accessory-port-on-a-2017-bmw-g310-gs/</link><guid isPermaLink="false">64bdf1262b02a13be13783e6</guid><dc:creator><![CDATA[Zeke Ross]]></dc:creator><pubDate>Mon, 24 Jul 2023 04:12:07 GMT</pubDate><media:content url="https://zekial.io/content/images/2023/07/20230501_183424.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://zekial.io/content/images/2023/07/20230501_183424.jpg" alt="Where and How to Use the Accessory Port on a 2017+ BMW G310 GS"><p>So you want to add a 12 volt accessory, say a GPS or a USB charger for your cell phone or Cardo or something to your G310 GS. You could just wire it straight off the battery, but then every time you turn the bike off you need to go to the accessory and turn it off manually. If not, you risk the chance of coming back to a dead bike. Alternatively, you can cut into the ignition harness and put in a relay to run all your 12v accessories, but that is going to violate your warranty and also make a huge mess. </p><p>Conveniently, BMW includes two 12v accessory plugs on most of their bikes. On most GS models it lives in the battery compartment, but since the G310R is naked in the front, BMW decided to place it behind the headlamp instead since it was easier to access for the handlebar accessories most people would be installing. Unfortunately, when they made the GS model, they didn&apos;t bother to move the accessory ports. That means that it&apos;s covered by a load of plastic on the G310GS. </p><p>No need to panic, however, the forums are greatly exaggerating how hard it is to actually get to this port and install whatever you want. You <strong><em>DO NOT</em></strong> need to remove the front beak and display surround to access this. As long as you are a bit careful, that is. </p><h3 id="what-you-need">What you need:</h3><div class="kg-card kg-toggle-card" data-kg-toggle-state="close"><div class="kg-toggle-heading"><h4 class="kg-toggle-heading-text">Items:</h4><button class="kg-toggle-card-icon"><svg id="Regular" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path class="cls-1" d="M23.25,7.311,12.53,18.03a.749.749,0,0,1-1.06,0L.75,7.311"/></svg></button></div><div class="kg-toggle-content"><ul><li>Metric Hex Wrench Set</li><li>Accessory Plug Harness for a G310 GS (<a href="https://www.ebay.com/itm/234287130363">I bought this one on eBay</a>. If out of stock there are several similar listings)</li><li>Some way of attaching the accessory plug harness to your accessory</li></ul></div></div><h3 id="step-by-step-guide">Step-By-Step Guide:</h3><p>First, locate the two bolts holding the headlamp from the sides. These are right in front of the turn signals. If i remember correctly these are 6mm hex but i could be wrong on that. Either way, use a metric hex wrench to remove the bolts from both sides.</p><figure class="kg-card kg-image-card"><img src="https://zekial.io/content/images/2023/07/DSC01197--2-.jpg" class="kg-image" alt="Where and How to Use the Accessory Port on a 2017+ BMW G310 GS" loading="lazy" width="2000" height="1329" srcset="https://zekial.io/content/images/size/w600/2023/07/DSC01197--2-.jpg 600w, https://zekial.io/content/images/size/w1000/2023/07/DSC01197--2-.jpg 1000w, https://zekial.io/content/images/size/w1600/2023/07/DSC01197--2-.jpg 1600w, https://zekial.io/content/images/size/w2400/2023/07/DSC01197--2-.jpg 2400w" sizes="(min-width: 720px) 720px"></figure><p>Next, you need to find the two bolts holding the headlamp in from the bottom. These are the same size as the top ones, but are somewhat awkward to remove since there is a hard plastic hose in the way. Unscrew these, and when removing be careful not to lose the grommet washers as they like to fall out. </p><figure class="kg-card kg-image-card"><img src="https://zekial.io/content/images/2023/07/DSC01201--2-.jpg" class="kg-image" alt="Where and How to Use the Accessory Port on a 2017+ BMW G310 GS" loading="lazy" width="2000" height="1329" srcset="https://zekial.io/content/images/size/w600/2023/07/DSC01201--2-.jpg 600w, https://zekial.io/content/images/size/w1000/2023/07/DSC01201--2-.jpg 1000w, https://zekial.io/content/images/size/w1600/2023/07/DSC01201--2-.jpg 1600w, https://zekial.io/content/images/size/w2400/2023/07/DSC01201--2-.jpg 2400w" sizes="(min-width: 720px) 720px"></figure><p>Once all the bolts are removed, you need to remove the headlamp. This can be done by carefully bending the plastic of the headlamp surround out of the way and pulling the headlamp through. It is a very tight fit to get it out but it can come out. Just be careful not to stretch the surround too far and crack it or scratch the paint on the surround. </p><p>I find it easiest to pull it straight out, and then remove one of the side bolt holes from the surround, then pull the entire thing out sideways. </p><p>Once you have the headlamp free from the surround, you&apos;ll notice that there is a plug on the top right holding it to the bike. You can easily unplug the headlamp from the bike by pushing the top of the two buttons on the left and right side of the connector. Then just pull it straight up. It wasn&apos;t held in particularly tight on my bike.</p><p>Set the headlamp aside and let&apos;s look at the hole we just made</p><figure class="kg-card kg-image-card"><img src="https://zekial.io/content/images/2023/07/Inked20230723_133242.jpg" class="kg-image" alt="Where and How to Use the Accessory Port on a 2017+ BMW G310 GS" loading="lazy" width="2000" height="1500" srcset="https://zekial.io/content/images/size/w600/2023/07/Inked20230723_133242.jpg 600w, https://zekial.io/content/images/size/w1000/2023/07/Inked20230723_133242.jpg 1000w, https://zekial.io/content/images/size/w1600/2023/07/Inked20230723_133242.jpg 1600w, https://zekial.io/content/images/size/w2400/2023/07/Inked20230723_133242.jpg 2400w" sizes="(min-width: 720px) 720px"></figure><p>The ports we are looking for are connected to some dummy plugs on the top right of the headlight surround (next to where the headlamp wire runs). Remove one (or both) by pushing down on the plastic retaining clip release and pulling straight up or down. </p><p>From here, all we have to do is connect our female connector plug. Before installing it in the bike, I&apos;d recommend connecting it to your accessory on the bench. I soldered the harness for my zumo XT gps to the harness I purchased and heat shrink&apos;d the connection, but feel free to crimp, wire nut, whatever you think works best for automotive wiring. I know everyone tends to be opinionated on that and I won&apos;t be the one to tell you you&apos;re doing it wrong. </p><p>Once it&apos;s on the harness, just plug it to the male side of the connector on the bike and tie down your extra cables. BMW conveniently left a little square hole leading out of this compartment to the bars so you won&apos;t need to do any cutting to get your accessories&apos; wires out. From here, just reinstall the headlamp the way it came out. Be mindful of the grommet washers on the top of the headlamp as they like to pop out when putting the headlamp back in. I found it easiest to push the bottom platform of the headlamp against them to where they start to pull out, and just pushed them down and under with my fingers through the holes next to the turn signals. </p><p>Once the headlamp is in, it will need to be adjusted according to the settings on your owners manual. That being said, I find the LED headlamps included on the 2022+ models don&apos;t actually have any adjustment whatsoever and only go in one way. From there, enjoy your accessories! </p><figure class="kg-card kg-image-card"><img src="https://zekial.io/content/images/2023/07/image.png" class="kg-image" alt="Where and How to Use the Accessory Port on a 2017+ BMW G310 GS" loading="lazy" width="1343" height="1007" srcset="https://zekial.io/content/images/size/w600/2023/07/image.png 600w, https://zekial.io/content/images/size/w1000/2023/07/image.png 1000w, https://zekial.io/content/images/2023/07/image.png 1343w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item></channel></rss>