<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tag 'powershell'</title><link>http://forums.asp.net/search/SearchResults.aspx?q=&amp;tag=powershell&amp;orTags=0&amp;o=DateDescending</link><description>Search results matching tag 'powershell'</description><dc:language>en-US</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Returning an array from COM+ component</title><link>http://forums.asp.net/thread/3509340.aspx</link><pubDate>Thu, 12 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3509340</guid><dc:creator>Swackhammer1</dc:creator><description>&lt;p&gt;Hi I return an array from a COM+ component however when I try to access the data from the .cs code, I get the following error:&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="xhtml"&gt;System.NullReferenceException: Object reference not set to an instance of an object. at SSEF._Default.EnableForwarding(String domain, String domainController, String username)&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;for the line &lt;/p&gt;&lt;p&gt;EmailAddress = mailbox[0]&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This is the component calling code:&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;private void EnableForwarding(string domain, string domainController, string username)&lt;br /&gt;        {&lt;br /&gt;            Response.Write(string.Format(&amp;quot;&amp;lt;b&amp;gt;Web Application Context:&amp;lt;/b&amp;gt; {0}&amp;lt;br&amp;gt;&amp;quot;, WindowsIdentity.GetCurrent().Name));&lt;br /&gt;&lt;br /&gt;            // Create the COM+ component&lt;br /&gt;            PowerShellComponent.ManagementCommands objManage = new PowerShellComponent.ManagementCommands();&lt;br /&gt;&lt;br /&gt;            String[] mailbox = new string[2];&lt;br /&gt;            String EmailAddress;&lt;br /&gt;            String ContactName;&lt;br /&gt;            String ExternalAddress;&lt;br /&gt;            String[] mailbox = objManage.GetMailbox(domain, domainController, username);&lt;br /&gt;            //Response.Write(Results);&lt;br /&gt;            EmailAddress = mailbox[0]&lt;br /&gt;            ContactName = mailbox[1];&lt;br /&gt;            //ContactName = &amp;quot;Disabled&amp;quot;;&lt;br /&gt;            //Response.Write(&amp;quot;Contact Name: &amp;quot; + Results);&lt;br /&gt;            if (!(ContactName == &amp;quot;Disabled&amp;quot;))&lt;br /&gt;            {&lt;br /&gt;                ExternalAddress = objManage.GetMailContact(domain, domainController, ContactName);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                ExternalAddress = &amp;quot;Disabled&amp;quot;;&lt;br /&gt;            }&lt;br /&gt;            //Response.Write(&amp;quot;External Address: &amp;quot; + ExternalAddress);&lt;br /&gt;            EmailAddressLabel.Text = EmailAddress;&lt;br /&gt;            ForwardingAddressLabel.Text = ExternalAddress;&lt;br /&gt;            // Print out the security context of the component&lt;br /&gt;            Response.Write(string.Format(&amp;quot;&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Component Context:&amp;lt;/b&amp;gt; {0}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;quot;, objManage.GetIdentity()));&lt;br /&gt;&lt;br /&gt;            objManage = null;&lt;br /&gt;&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Given below is the code (partial) for my component:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;        public String[] GetMailbox(string domain, string domainController, string username)&lt;br /&gt;        {&lt;br /&gt;            String[] errorText = new string[1];&lt;br /&gt;            String forwardingAddress = &amp;quot;&amp;quot;;&lt;br /&gt;            String windowsEmailAddress = &amp;quot;&amp;quot;;&lt;br /&gt;            String[] results = new string[2];&lt;br /&gt;            String contact = &amp;quot;&amp;quot;;&lt;br /&gt;            Collection&amp;lt;System.Management.Automation.PSObject&amp;gt; cmdResults = new Collection&amp;lt;System.Management.Automation.PSObject&amp;gt;();&lt;br /&gt;            RunspaceConfiguration config = RunspaceConfiguration.Create();&lt;br /&gt;            PSSnapInException warning;&lt;br /&gt;&lt;br /&gt;            // Load Exchange PowerShell snap-in.&lt;br /&gt;            config.AddPSSnapIn(&amp;quot;Microsoft.Exchange.Management.PowerShell.Admin&amp;quot;, out warning);&lt;br /&gt;            if (warning != null) throw warning;&lt;br /&gt;&lt;br /&gt;            using (Runspace thisRunspace = RunspaceFactory.CreateRunspace(config))&lt;br /&gt;            {&lt;br /&gt;                try&lt;br /&gt;                {&lt;br /&gt;                    thisRunspace.Open();&lt;br /&gt;                    using (Pipeline thisPipeline = thisRunspace.CreatePipeline())&lt;br /&gt;                    {&lt;br /&gt;                        //Please change parameter values.&lt;br /&gt;                        thisPipeline.Commands.Add(&amp;quot;Get-Mailbox&amp;quot;);&lt;br /&gt;                        thisPipeline.Commands[0].Parameters.Add(&amp;quot;Identity&amp;quot;, username);&lt;br /&gt;                        &lt;br /&gt;                        // Need the line below when impersonating. KB943937. Need rollup 1 for sp1.&lt;br /&gt;                        thisPipeline.Commands[0].Parameters.Add(&amp;quot;DomainController&amp;quot;, domainController);&lt;br /&gt;                        //thisPipeline.Commands.Add(&amp;quot;Select-Object&amp;quot;);&lt;br /&gt;                        //thisPipeline.Commands[1].Parameters.Add(&amp;quot;Property&amp;quot;, &amp;quot;ForwardingAddress&amp;quot;);&lt;br /&gt;&lt;br /&gt;                        try&lt;br /&gt;                        {&lt;br /&gt;                            cmdResults = thisPipeline.Invoke();&lt;br /&gt;                            windowsEmailAddress = ((cmdResults[0].Properties[&amp;quot;WindowsEmailAddress&amp;quot;]).Value).ToString();&lt;br /&gt;&lt;br /&gt;                            if (!(cmdResults[0].Properties[&amp;quot;ForwardingAddress&amp;quot;] == null))// || (cmdResults[0].Properties[&amp;quot;ForwardingAddress&amp;quot;] == &amp;quot;&amp;quot;))&lt;br /&gt;                            {&lt;br /&gt;                                forwardingAddress = ((cmdResults[0].Properties[&amp;quot;ForwardingAddress&amp;quot;]).Value).ToString();&lt;br /&gt;&lt;br /&gt;                                if (String.IsNullOrEmpty(forwardingAddress) == true)&lt;br /&gt;                                {&lt;br /&gt;                                    contact = &amp;quot;Disabled&amp;quot;;&lt;br /&gt;                                }&lt;br /&gt;                                else&lt;br /&gt;                                {&lt;br /&gt;                                    char[] splitter = { &amp;#39;/&amp;#39; };&lt;br /&gt;                                    String[] words = new string[3];&lt;br /&gt;                                    words = forwardingAddress.Split(splitter);&lt;br /&gt;                                    contact = words[2];&lt;br /&gt;                                }&lt;br /&gt;&lt;br /&gt;                            }&lt;br /&gt;                            else&lt;br /&gt;                            {&lt;br /&gt;                                contact = &amp;quot;Disabled&amp;quot;;&lt;br /&gt;                            }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                            results[0] = windowsEmailAddress;&lt;br /&gt;                            results[1] = contact;&lt;br /&gt;&lt;br /&gt;                        }&lt;br /&gt;                        catch (Exception ex)&lt;br /&gt;                        {&lt;br /&gt;                            errorText[0] = &amp;quot;Error: &amp;quot; + ex.ToString();&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;                        // Check for errors in the pipeline and throw an exception if necessary.&lt;br /&gt;                        if (thisPipeline.Error != null &amp;amp;&amp;amp; thisPipeline.Error.Count &amp;gt; 0)&lt;br /&gt;                        {&lt;br /&gt;                            StringBuilder pipelineError = new StringBuilder();&lt;br /&gt;                            pipelineError.AppendFormat(&amp;quot;Error calling Get-Mailbox.&amp;quot;);&lt;br /&gt;                            foreach (object item in thisPipeline.Error.ReadToEnd())&lt;br /&gt;                            {&lt;br /&gt;                                pipelineError.AppendFormat(&amp;quot;{0}\n&amp;quot;, item.ToString());&lt;br /&gt;                            }&lt;br /&gt;&lt;br /&gt;                            errorText[0] = errorText[0] + &amp;quot;Error: &amp;quot; + pipelineError.ToString();&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                finally&lt;br /&gt;                {&lt;br /&gt;                    thisRunspace.Close();&lt;br /&gt;                    //EndImpersonation();&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            if (errorText[0] == &amp;quot;&amp;quot;)&lt;br /&gt;                //return &amp;quot;Success \n Contact Name:&amp;quot; + contact;&lt;br /&gt;                return results;&lt;br /&gt;            else&lt;br /&gt;                return errorText;&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;I realize the code is a bit of a mess right now, but any help would be appreciated.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thanks,&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Generate Database Scripts using PowerShell</title><link>http://forums.asp.net/thread/3443704.aspx</link><pubDate>Tue, 06 Oct 2009 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3443704</guid><dc:creator>FileFoundException</dc:creator><description>&lt;p&gt;Using windows powershell you can generate scripts for a database and its objects&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.mssqltips.com/tip.asp?tip=1842&amp;amp;home"&gt;http://www.mssqltips.com/tip.asp?tip=1842&amp;amp;home&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;here is a snippet from the article&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;font face="Courier New" size="2"&gt;&lt;span style="color:black;"&gt;[System.Reflection.Assembly]&lt;/span&gt;&lt;span style="color:gray;"&gt;::&lt;/span&gt;&lt;span style="color:black;"&gt;LoadWithPartialName&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:black;"&gt;&amp;#39;Microsoft.SqlServer.SMO&amp;#39;)&amp;nbsp;|&amp;nbsp;out-null &lt;br /&gt;$s&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;nbsp;new&lt;/span&gt;&lt;span style="color:gray;"&gt;-&lt;/span&gt;&lt;span style="color:blue;"&gt;object&amp;nbsp;&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:black;"&gt;&amp;#39;Microsoft.SqlServer.Management.Smo.Server&amp;#39;)&amp;nbsp;&amp;quot;LOCALHOST\SQL2005_1&amp;quot;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;$dbs&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:black;"&gt;$s.Databases &lt;br /&gt;&lt;br /&gt;$dbs[&amp;quot;Northwind&amp;quot;].Script&lt;/span&gt;&lt;span style="color:gray;"&gt;()&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>powershell in asp.net</title><link>http://forums.asp.net/thread/3425659.aspx</link><pubDate>Fri, 25 Sep 2009 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3425659</guid><dc:creator>raja777</dc:creator><description>&lt;p&gt;I am facing problem with creating mailbox using powershell in asp.net. I am getting Exception like:Messages history

Active Directory operation failed on Domaincontroller. This error is 
not retriable. Additional information: Access is denied. Active directory 
response: 00000005: SecErr: DSID-03151E04, problem 4003 (INSUFF_ACCESS_RIGHTS), 
data 0.&lt;/p&gt;&lt;p&gt;same script is perfectly working in windows and console applications.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Modify Mailbox - X500 and EUM alias problem</title><link>http://forums.asp.net/thread/2684656.aspx</link><pubDate>Wed, 15 Oct 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2684656</guid><dc:creator>TomBeus</dc:creator><description>&lt;p&gt;The modify mailbox function seems to have a problem&lt;br /&gt;with X500 en EUM aliases.&lt;br /&gt;&lt;br /&gt;When getting a mailbox the mailadresses array can contain an alias like:&lt;br /&gt;&lt;br /&gt;X500:/o=Hosted Exchange/ou=First Administrative Group/cn=Recipients/cn=mymailboxalias&lt;br /&gt;EUM:2200;phone-context=myorganisation.hmc.local&lt;br /&gt;&lt;br /&gt;If I then try to modify the mailbox with such an alias, the system throws an error.&lt;br /&gt;&lt;br /&gt;The only solution I found so far is with exchange powershell:&lt;br /&gt;&lt;br /&gt;$foo = get-mailbox mymailboxalias&lt;br /&gt;$foo.emailaddresses += &amp;quot;X500:/o=Hosted Exchange/ou=First Administrative Group/cn=Recipients/cn=mymailboxalias&amp;quot;&lt;br /&gt;$foo.emailaddresses += &amp;quot;EUM:2200;phone-context=myorganisation.hmc.local&amp;quot;&lt;br /&gt;$foo | set-mailbox&lt;br /&gt;&lt;br /&gt;But I wonder If I can do the same thing with MPS webservices?&lt;br /&gt;Does anyone know a solution?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: New-Mailbox Issues</title><link>http://forums.asp.net/thread/2584669.aspx</link><pubDate>Wed, 27 Aug 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2584669</guid><dc:creator>KarlMitschke</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;loxschpen&amp;quot;]First the bad: the fact of it all is that you CANNOT run the Exchange Management Shell from ANY ASP&amp;gt;NET application. [/quote]&lt;/p&gt;
&lt;p&gt;Hello;&lt;/p&gt;
&lt;p&gt;That&amp;#39;s not exactly true. See my posts on powershellcommunity.org:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://powershellcommunity.org/Forums/tabid/54/forumid/3/postid/524/view/topic/Default.aspx"&gt;http://powershellcommunity.org/Forums/tabid/54/forumid/3/postid/524/view/topic/Default.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://powershellcommunity.poshcode.org/505"&gt;http://powershellcommunity.poshcode.org/505&lt;/a&gt; - MailboxTasks.aspx&lt;br /&gt;&lt;a href="http://powershellcommunity.poshcode.org/506"&gt;http://powershellcommunity.poshcode.org/506&lt;/a&gt; - MailboxTasks.aspx.cs&lt;br /&gt;&lt;a href="http://powershellcommunity.poshcode.org/507"&gt;http://powershellcommunity.poshcode.org/507&lt;/a&gt; - MailboxConfirm.aspx&lt;br /&gt;&lt;a href="http://powershellcommunity.poshcode.org/508"&gt;http://powershellcommunity.poshcode.org/508&lt;/a&gt; - MailboxConfirm.aspx.cs&lt;br /&gt;&lt;a href="http://powershellcommunity.poshcode.org/509"&gt;http://powershellcommunity.poshcode.org/509&lt;/a&gt; - MailboxTaskResults.aspx&lt;br /&gt;&lt;a href="http://powershellcommunity.poshcode.org/510"&gt;http://powershellcommunity.poshcode.org/510&lt;/a&gt; - MailboxTaskResults.aspx.cs&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Karl&lt;/p&gt;</description></item><item><title>How to find all Certificate Authorities (CA) in your domain?</title><link>http://forums.asp.net/thread/2539829.aspx</link><pubDate>Wed, 06 Aug 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2539829</guid><dc:creator>r.heinkens</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I want to perform a check on the certificate authorities in my domain using ASP.NET and C#. I want to list all certificate authorities and validatie that they are alive. Does anyone know how to list all CA&amp;#39;s? Below is a PowerShell equivalent using CertUtil. $Result contains all the lines resulting from the dump from CertUtil.&lt;/p&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;
&lt;p&gt;$Result = (Invoke-Expression &amp;quot;$Env:SystemRoot\System32\certutil.exe&amp;quot;)&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Running a powershell script while compilation</title><link>http://forums.asp.net/thread/2521668.aspx</link><pubDate>Tue, 29 Jul 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2521668</guid><dc:creator>ash143gupta</dc:creator><description>&lt;p&gt;&amp;nbsp;Hi i want to compress all my png&amp;#39;s using software called optiping but instead of doing it manually i want it to be done automatically on every compilation of my website i have the script which is mentioned below but i dont know how to run it. should i make a batch file , i tried that also but dont know how to get it executed while compilation and building process is going on.&lt;/p&gt;&lt;p&gt;If there is some other way to achieve this than please write the process and explain each step as i am new to powershell.&lt;/p&gt;&lt;p&gt;Here is the script which will search all png&amp;#39;s in my website and try to compress them&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;gci -include *.png -recurse | &lt;span class="kwd"&gt;foreach&lt;/span&gt;
 { $fileName = $_.FullName; cmd /c &lt;span class="st"&gt;&amp;quot;C:\soft\png\optipng.exe -o7 `&amp;quot;&lt;/span&gt;$fileName`&lt;span class="st"&gt;&amp;quot;&amp;quot;&lt;/span&gt; }&lt;/pre&gt;&amp;nbsp;&amp;nbsp;</description></item><item><title>Running powershell scripts along with compilation in VS2008 while deploying</title><link>http://forums.asp.net/thread/2518307.aspx</link><pubDate>Mon, 28 Jul 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2518307</guid><dc:creator>ash143gupta</dc:creator><description>&lt;p&gt;&amp;nbsp;Hi all i want to run a powershell script to compress all my png&amp;#39;s and jpegs. I have the script but i dont know how to run it while the website is being compiled.&lt;/p&gt;&lt;p&gt;Could anyone please tell me which file shall i make and where should i place that file so that the content in it ie the powershell script may run along with compilig and reduce the size of my png&amp;#39;s.&lt;/p&gt;&lt;p&gt;I think this script file should be inside the root folder of my website but its only a guess.&lt;/p&gt;&lt;p&gt;Please Help its urgent &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Announcement: IT Administrators with PowerShell skills wanted for Usability Study (Redmond)</title><link>http://forums.asp.net/thread/2422919.aspx</link><pubDate>Fri, 13 Jun 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2422919</guid><dc:creator>itusable</dc:creator><description>&lt;font face="Calibri" size="3"&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;Microsoft Usability is conducting a study focusing on the remoting feature of PowerShell version 2 from July 22 to July 29, 2008. This is a great opportunity for IT administrators who have experience working with PowerShell to provide feedback and help improve the user experience of PowerShell version 2. &lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;span style="FONT-SIZE:11pt;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;The study will be conducted in a lab setting on Microsoft’s main campus in Redmond, Washington. Additional studies on other v2 features are also being planned.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:11pt;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:11pt;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;
&lt;p style="MARGIN:0in 0in 0pt;"&gt;&lt;b&gt;&lt;span style="FONT-SIZE:11pt;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;As a token of our appreciation each participant will receive a gift item they select from a list of some of Microsoft&amp;#39;s most popular hardware and software titles.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="MARGIN:0in 0in 0pt;"&gt;&lt;b&gt;&lt;span style="FONT-SIZE:11pt;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="FONT-SIZE:11pt;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;If you are interested or know someone who could be interested in participating, please email us at &lt;a href="mailto:itusable@microsoft.com"&gt;&lt;font color="#0000ff"&gt;itusable@microsoft.com&lt;/font&gt;&lt;/a&gt; with name and contact information. For information on other studies and to learn more about Microsoft&amp;#39;s &lt;span style="FONT-SIZE:11pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-bidi;"&gt;User Research program email us. &lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;</description></item><item><title>New-Mailbox Issues</title><link>http://forums.asp.net/thread/2408799.aspx</link><pubDate>Sat, 07 Jun 2008 04:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2408799</guid><dc:creator>loxschpen</dc:creator><description>&lt;p&gt;Hi Everyone,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; I have created the following powershell script to create a new mailbox-enabled user in Exchange 2007:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="coloredcode"&gt;($Private:secureString = ConvertTo-SecureString &lt;span class="st"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt; -AsPlainText -Force) | &lt;span class="kwd"&gt;foreach&lt;/span&gt; {New-mailbox -UserPrincipalName chris@contoso.com -alias chris -Name ChrisAshton -OrganizationalUnit aod -FirstName Chris -LastName Ashton -DisplayName &lt;span class="st"&gt;&amp;quot;Chris Ashton&amp;quot;&lt;/span&gt; -Database &lt;span class="st"&gt;&amp;quot;cd747c5d-aa8e-4f81-a136-ea4ff89e2896&amp;quot;&lt;/span&gt; -Password $secureString}&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Now this creates a user in my Exchange 2007 Server store with the specific Mailbox Store GUID of cd747c5d-aa8e-4f81-a136-ea4ff89e2896. Now the issue I am having is when I port this to a C# application I have developed. When I execute the same script through the following code:&lt;/p&gt;&lt;pre class="coloredcode"&gt;        ExchangeManagementShellWrapper ems = ExchangeManagementShellWrapper.Instance;
        ICollection results;

        results = ems.RunspaceInvoke(&lt;span class="st"&gt;&amp;quot;($Private:secureString = ConvertTo-SecureString \&amp;quot;&lt;/span&gt;password\&lt;span class="st"&gt;&amp;quot; -AsPlainText -Force) | foreach {New-mailbox -UserPrincipalName chris@contoso.com -alias chris -Name ChrisAshton -OrganizationalUnit aod -FirstName Chris -LastName Ashton -DisplayName \&amp;quot;&lt;/span&gt;Chris Ashton\&lt;span class="st"&gt;&amp;quot; -Database \&amp;quot;&lt;/span&gt;cd747c5d-aa8e-4f81-a136-ea4ff89e2896\&lt;span class="st"&gt;&amp;quot; -Password $secureString}&amp;quot;&lt;/span&gt;);
        &lt;span class="cmt"&gt;//results = ems.RunspaceInvoke(&amp;quot;$input | New-mailbox -UserPrincipalName chris@contoso.com -alias chris -database &amp;#39;delaprv2\\resellers\\resellers&amp;#39; -Name ChrisAshton -OrganizationalUnit aod -password -FirstName Chris -LastName Ashton -DisplayName ChrisAshton&amp;quot;, secString.ToString());&lt;/span&gt;

        &lt;span class="kwd"&gt;foreach&lt;/span&gt; (PSObject item &lt;span class="kwd"&gt;in&lt;/span&gt; results)
        {
            TextBox5.Text = item.Members[&lt;span class="st"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;].Value.ToString();
        }&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; It yields the following error:&lt;/p&gt;
&lt;blockquote&gt;
&lt;h2&gt;&lt;i&gt;Database &amp;quot;cd747c5d-aa8e-4f81-a136-ea4ff89e2896&amp;quot; was not found. Please make sure you have typed it correctly.&lt;/i&gt; &lt;/h2&gt;
&lt;p&gt;&lt;font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt;&lt;b&gt;Description: &lt;/b&gt;An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Exception Details: &lt;/b&gt;Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException: Database &amp;quot;cd747c5d-aa8e-4f81-a136-ea4ff89e2896&amp;quot; was not found. Please make sure you have typed it correctly.&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Now mind you that I can execute any other Exchange 2007 Powershell command without any issues through this same code and the script I am using works flawlessly in powershell. Why can it find the database in powershell but not in the C# application which have been executed off the same server? Any suggestions are greatly appreciated.&lt;/p&gt;
&lt;p&gt;-Timothy&lt;/p&gt;</description></item></channel></rss>