<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Kotesh Bandhamravuri</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/koteshb/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/koteshb/feed.xml</link>
    <description>Blog to learn, learn to blog</description>
    <lastBuildDate>Tue, 16 Apr 2019 06:20:03 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>PowerShell - Referencing variable in current scope</title>
      <link>https://docs.microsoft.com/archive/blogs/koteshb/powershell-referencing-variable-in-current-scope</link>
      <pubDate>Tue, 23 Feb 2010 15:53:00 GMT</pubDate>
      <dc:creator><![CDATA[koteshblog]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/koteshb/2010/02/23/powershell-referencing-variable-in-current-scope/</guid>
      <description><![CDATA[PowerShell allows creating variables dynamically without declaring. During assignment, it also...]]></description>
      <content:encoded><![CDATA[<P>PowerShell allows creating variables dynamically without declaring. During assignment, it also creates new variables in the inner scope (unlike programming languages, where there is only one instance of the variable).</P>
<P>The following examples will make it clear on scoping rule </P><PRE>Save the following script into a file ScopeTest1.ps1</PRE><PRE><STRONG>$myvar = "Hello World"
function PrintHelloWorld 
{ 
  $myvar = "Hello Universe"
  Write-Host "$myvar"
} 
Write-Host "$myvar" 
PrintHelloWorld 
Write-Host "$myvar"
</STRONG>
PS C:\PowerShellExamples&gt; .\ScopeTest1.ps1
Hello World
Hello Universe
Hello World
</PRE><PRE>Now save the following script into a file ScopeTest2.ps1</PRE><PRE><STRONG>$myvar = "Hello World"
function PrintHelloWorld 
{ 
  ([ref]$myvar).Value = "Hello Universe" &nbsp;&nbsp; Write-Host "$myvar" 
} 
Write-Host "$myvar" 
PrintHelloWorld 
Write-Host "$myvar"
</STRONG>
PS C:\PowerShellExamples&gt; .\ScopeTest2.ps1
Hello World
Hello Universe
Hello Universe
</PRE>In ScopeTest2.ps1, a new $myvar is not created in function scope. Existing variable is referenced and updated ]]></content:encoded>
    </item>
    <item>
      <title>PowerShell - How to read a file</title>
      <link>https://docs.microsoft.com/archive/blogs/koteshb/powershell-how-to-read-a-file</link>
      <pubDate>Fri, 12 Feb 2010 22:06:00 GMT</pubDate>
      <dc:creator><![CDATA[koteshblog]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/koteshb/2010/02/12/powershell-how-to-read-a-file/</guid>
      <description><![CDATA[$contents = Get-Content C:\context.txt]]></description>
      <content:encoded><![CDATA[<P>$contents = Get-Content C:\context.txt</P>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell - How to create a PSCredential object</title>
      <link>https://docs.microsoft.com/archive/blogs/koteshb/powershell-how-to-create-a-pscredential-object</link>
      <pubDate>Fri, 12 Feb 2010 21:50:00 GMT</pubDate>
      <dc:creator><![CDATA[koteshblog]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/koteshb/2010/02/12/powershell-how-to-create-a-pscredential-object/</guid>
      <description><![CDATA[Several PowerShell commandlets take a PSCredential object to run using a particular user account....]]></description>
      <content:encoded><![CDATA[<P>Several PowerShell commandlets take a PSCredential object to run using a particular user account. You can create the PSCredential object by using Get-Credential commandlet which opens a dialog to enter the username and password. This&nbsp;way of entering credentials can be&nbsp;used in an interactive mode.</P>
<P><STRONG>$mycredentials = Get-Credential</STRONG></P>
<P>When you have to provide credentials in non-interactive mode, you can create&nbsp;a PSCredential object&nbsp;in the following way.</P>
<P><STRONG>$secpasswd = ConvertTo-SecureString&nbsp;"PlainTextPassword" -AsPlainText -Force<BR>$mycreds = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)</STRONG></P>
<P>You can now pass <STRONG>$mycreds</STRONG> to any <STRONG>-PSCredential</STRONG> input parameter</P>
<P>* You may not want to reveal PlainTextPassword for your personal accounts as a general precaution. Use a common user account and password that everyone knows for your non-interactive PSCredential usage.</P>
<P>* Tested with PowerShell 2.0</P>
<P mce_keep="true">&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell - How to find details of Operating System</title>
      <link>https://docs.microsoft.com/archive/blogs/koteshb/powershell-how-to-find-details-of-operating-system</link>
      <pubDate>Fri, 12 Feb 2010 21:21:00 GMT</pubDate>
      <dc:creator><![CDATA[koteshblog]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/koteshb/2010/02/12/powershell-how-to-find-details-of-operating-system/</guid>
      <description><![CDATA[There were several instances where I had to find details of the operating system using PowerShell....]]></description>
      <content:encoded><![CDATA[<P>There were several instances where I had to find details of the operating system using PowerShell. Here, I am providing several PowerShell snippets that return various details of the Operating System.</P>
<P><EM>Name of the Operating System</EM></P>
<P>PS C:\&gt; <STRONG>(Get-WmiObject Win32_OperatingSystem).Name</STRONG></P>
<P><EM>Is Operating System 32-bit or 64-bit</EM></P>
<P>PS C:\&gt;&nbsp;<STRONG>(Get-WmiObject Win32_OperatingSystem).OSArchitecture</STRONG></P>
<P><EM>Name of the Machine</EM></P>
<P>PS C:\&gt; <STRONG>(Get-WmiObject Win32_OperatingSystem).CSName</STRONG></P>
<P><EM>There are many more&nbsp;properties&nbsp;of the Operating System that&nbsp;are exposed.&nbsp;To&nbsp;obtain more details,&nbsp;run the following</EM></P>
<P>PS C:\&gt; <STRONG>Get-WmiObject Win32_OperatingSystem&nbsp;| Get-Member</STRONG></P>
<P>* Tested using PowerShell 2.0</P>]]></content:encoded>
    </item>
    <item>
      <title>First things first</title>
      <link>https://docs.microsoft.com/archive/blogs/koteshb/first-things-first</link>
      <pubDate>Fri, 12 Feb 2010 21:07:00 GMT</pubDate>
      <dc:creator><![CDATA[koteshblog]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/koteshb/2010/02/12/first-things-first/</guid>
      <description><![CDATA[The first programs that I wrote was 
BK&nbsp;Logo
10 PRINT "HELLO WORLD" (BASIC)
main () { printf...]]></description>
      <content:encoded><![CDATA[<P>The first programs that I wrote was </P>
<P>BK&nbsp;<EM>Logo</EM></P>
<P>10 PRINT "HELLO WORLD" (<EM>BASIC</EM>)</P>
<P>main () { printf ("Hello World" } (<EM>C</EM>)</P>
<P mce_keep="true">main () { cout &lt;&lt; "Hello World"; } (<EM>C++</EM>)</P>
<P mce_keep="true">main () { Console.WriteLine("Hello World"&nbsp;} (<EM>C#</EM>)</P>
<P mce_keep="true">"Hello World" (<EM>PowerShell</EM>)</P>]]></content:encoded>
    </item>
  </channel>
</rss>