Pass argument into Powershell
<p>I have a powershell script that completes some tasks in Active Directory and MS Exchange. I need to pass in the Active Directory username from our call logging system. Having the Call log system pass the argument is simple.</p>

<p>The problem i am facing is having powershell read the argument into a variable. </p>

<p>I will provide a proof of concept example. </p>

<p>Here is a sample command passing the argument into powershell. </p>

<pre><code>C:\Users\UserName\Desktop\Test.ps1 -ADusername "Hello World"
</code></pre>

<p>Here is the sample script:</p>

<pre><code>Param([string]$adusername)
$adusername
pause
</code></pre>

<p>I am Expecting the following output:</p>

<pre><code>Hello World
Press Enter to continue...:
</code></pre>

<p>This is the actual output:</p>

<pre><code>Press Enter to continue...:
</code></pre>

<p>Just wrapping my head around this core concept will help me immensely. I was unable to find any examples or tutorials that worked when applied to my scenario. I apologize if this is a duplicate post, couldnt find anything on this site as well. </p>

<p>EDIT: per request, this is my full script: <a href="http://pastebin.com/ktjpLQek" rel="nofollow">http://pastebin.com/ktjpLQek</a></p>