<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PowerShell on Mexicali IT</title><link>https://mxlit.com/technologies/powershell/</link><description>Recent content in PowerShell on Mexicali IT</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 30 Mar 2026 16:20:00 -0700</lastBuildDate><atom:link href="https://mxlit.com/technologies/powershell/index.xml" rel="self" type="application/rss+xml"/><item><title>Zero-Trust Endpoint Isolation: Containment via Offline SIDs</title><link>https://mxlit.com/kb-00088/</link><pubDate>Mon, 30 Mar 2026 16:20:00 -0700</pubDate><guid>https://mxlit.com/kb-00088/</guid><description>&lt;p&gt;When a user is terminated in &lt;strong&gt;Active Directory&lt;/strong&gt;, the first line of defense is instantly engaged: denial of corporate access, which disconnects their VPN sessions and blocks interactive logins through the Domain Controller (DC).&lt;/p&gt;
&lt;p&gt;However, there is a critical risk vector. If the employee (or a malicious attacker) has their corporate laptop, the local Windows &lt;code&gt;Cached Credentials&lt;/code&gt; will continue to operate. This allows them to log into the machine &amp;ldquo;offline&amp;rdquo; (from the domain) and &lt;strong&gt;extract sensitive files locally onto a USB drive&lt;/strong&gt; without needing to be connected to the corporate VPN or internal network.&lt;/p&gt;</description></item><item><title>PowerShell: How to Transfer Security Groups from One User to Another</title><link>https://mxlit.com/kb-00012/</link><pubDate>Thu, 14 Oct 2021 22:39:01 -0800</pubDate><guid>https://mxlit.com/kb-00012/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;A couple of days ago, I was asked for help copying security groups from one user to a new user. While it&amp;rsquo;s true that we can perform this task manually, sometimes a simple line of code can save us this work. This is helpful when the new user belongs to the same department as the user whose groups we want to copy.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s something to keep in mind before doing this: you should be aware that the user with the groups belonging to the department may have additional, previously authorized access. For example, they might have access to shared files because they&amp;rsquo;re part of a project, etc. This is why you should be careful when copying the groups in their entirety. If this isn&amp;rsquo;t the case, then the following script can be very helpful.&lt;/p&gt;</description></item><item><title>PowerShell: Send email to users when password will soon expire.</title><link>https://mxlit.com/kb-00011/</link><pubDate>Fri, 08 Oct 2021 22:39:01 -0800</pubDate><guid>https://mxlit.com/kb-00011/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;








&lt;blockquote class="blockquote-regular"&gt;
 &lt;p&gt;In this post, we&amp;rsquo;ll see how to alert users when their domain password will soon expire. To do this, we&amp;rsquo;ll create a PowerShell script.&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;This script is divided into three functions, which I will explain.&lt;/p&gt;

&lt;/blockquote&gt;
&lt;h2 id="send-email"&gt;Send-Email&lt;/h2&gt;
&lt;p&gt;Send-Email This function basically receives three parameters: Username, user email address, and the number of days remaining until the password expires.&lt;/p&gt;
&lt;p&gt;In this case, I&amp;rsquo;m using unauthenticated email. Please note that using unauthenticated email (no SSL and no password, using port 25) means you can only send internal emails. If you want to send emails outside your organization, you must use port 587, enable SSL, and enter a username and password. This will depend on your specific requirements.&lt;/p&gt;</description></item><item><title>PowerShell: Create security groups for each server, remove local administrators and add them to the new group.</title><link>https://mxlit.com/kb-00010/</link><pubDate>Mon, 13 Sep 2021 22:39:01 -0800</pubDate><guid>https://mxlit.com/kb-00010/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;








&lt;blockquote class="blockquote-regular"&gt;
 &lt;p&gt;Security Procedure: Local Administrator Control&lt;/p&gt;
&lt;p&gt;Some time ago, I was asked to find a method to implement certain security and control measures for users who are local administrators on each server. These measures required the following:&lt;/p&gt;
&lt;br&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Creation of Groups in AD:&lt;/strong&gt; Create a security group in Active Directory for each server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Assignment of Permissions:&lt;/strong&gt; Add the created group to the corresponding server with the local administrator role.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User Migration:&lt;/strong&gt; Find all current local administrators on the server and add them to the new AD group.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Account Removal:&lt;/strong&gt; Once the users are added to the AD group, remove them from the server&amp;rsquo;s local administrators group.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audit Log:&lt;/strong&gt; Save a log of the users who are administrators on each server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Notification:&lt;/strong&gt; Send an email with a report of the changes made.&lt;/li&gt;
&lt;/ol&gt;

&lt;/blockquote&gt;
&lt;p&gt;The idea behind all of this is to have control and know which users are local administrators on the servers. We&amp;rsquo;re talking about more than 500 servers, and managing them one by one would be quite complicated.&lt;/p&gt;</description></item><item><title>PowerShell: How to Create New Users in AD</title><link>https://mxlit.com/kb-00008/</link><pubDate>Tue, 31 Aug 2021 22:39:01 -0800</pubDate><guid>https://mxlit.com/kb-00008/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The easiest way to create users in AD is undoubtedly using Active Directory Users and Computers, provided you only want to create one or two users. But what if you want to create multiple users? In that case, I don&amp;rsquo;t think this method is the most suitable. For this, we will use PowerShell with the New-ADUser cmdlet.&lt;/p&gt;
&lt;p&gt;There are multiple parameters we can use with the New-ADUser cmdlet. If we check the syntax, we get the following:&lt;/p&gt;</description></item></channel></rss>