<?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 Ajo Mathew</title><link>https://blog.ajomathew.dev/tags/powershell/</link><description>Recent content in Powershell on Ajo Mathew</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Mon, 08 Jun 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.ajomathew.dev/tags/powershell/rss.xml" rel="self" type="application/rss+xml"/><item><title>Uninstall Az Powershell Module forcefully and completely</title><link>https://blog.ajomathew.dev/posts/2020-06-08-uninstall-az-powershell-module-forcefully-and-completely/</link><pubDate>Mon, 08 Jun 2020 00:00:00 +0000</pubDate><guid>https://blog.ajomathew.dev/posts/2020-06-08-uninstall-az-powershell-module-forcefully-and-completely/</guid><description>&lt;p&gt;I&amp;rsquo;m primarily using PowerShell to address Azure automation activities from running from local to Azure itself. The most painful task encountered is about upgrading PowerShell Az modules and making it work with VsCode.&lt;/p&gt;
&lt;p&gt;After many trial and error, this is the best method I could recommend to uninstall the PowerShell Az module.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Get-installedmodule Az.*| foreach-object{Uninstall-Module -Name $_.Name -Verbose -AllVersions -force}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you encounter running the above code snippet from the no-Admin account, switch to the Admin account. Incase Az.Accounts module is adamant in getting uninstalled, open a cmd - As Administrator and run below command. This will rid your system of Az modules.&lt;/p&gt;</description></item><item><title>SendGrid SMTP using Powershell and REST API</title><link>https://blog.ajomathew.dev/posts/2020-05-15-sendgrid-smtp-using-powershell-andrestapi/</link><pubDate>Fri, 15 May 2020 00:00:00 +0000</pubDate><guid>https://blog.ajomathew.dev/posts/2020-05-15-sendgrid-smtp-using-powershell-andrestapi/</guid><description>&lt;p&gt;Sendgrid stopped accepting &lt;code&gt;account username&lt;/code&gt; and &lt;code&gt;password&lt;/code&gt;. I was using powershell cmdlet send-mailmessage to run some of auditing scripts from VM&amp;rsquo;s and it all broken due to this. Final solution with out much modification our script is done by setting username as apikey and password as APIKEYVALUE. Details of the same is available with &lt;a href="https://sendgrid.com/docs/API_Reference/SMTP_API/integrating_with_the_smtp_api.html" target="_blank" rel="noopener"&gt;SendGrid Support page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let me know if this helps you. You can reach me on &lt;a href="https://twitter.com/ajo_mathew" target="_blank" rel="noopener"&gt;twitter&lt;/a&gt; for any queries.&lt;/p&gt;</description></item><item><title>Grant SQL Server account access to Lock Pages in Memory using PowerShell DSC.</title><link>https://blog.ajomathew.dev/posts/2017-03-07-grant-sql-server-account_access/</link><pubDate>Tue, 07 Mar 2017 00:00:00 +0000</pubDate><guid>https://blog.ajomathew.dev/posts/2017-03-07-grant-sql-server-account_access/</guid><description>&lt;p&gt;Lock Pages in Memory is a setting that can be set on 64-bit operating systems that essentially tell Windows not to swap out SQL Server memory to disk.&lt;/p&gt;
&lt;p&gt;I was implementing SQL server hardening via PowerShell DSC and one of the requirement was to have Lock Pages In Memory enabled for SQL Service account. There was a powershell script created and available from &lt;a href="http://keepingitgeek.blogspot.com/2015/01/grant-sql-server-account-access-to-lock.html" target="_blank" rel="noopener"&gt;blog post&lt;/a&gt; by keepingitgeek.&lt;/p&gt;
&lt;p&gt;I converted this to a DSC module for my use. The code snippet is added below.&lt;/p&gt;</description></item></channel></rss>