<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>risual support blog &#187; Powershell</title>
	<atom:link href="http://support.risualblogs.com/blog/tag/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://support.risualblogs.com/blog</link>
	<description>notes from the frontline</description>
	<lastBuildDate>Tue, 07 Feb 2012 13:33:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Running Exchange PowerShell as Scheduled Task</title>
		<link>http://support.risualblogs.com/blog/2011/12/01/running-exchange-powershell-as-scheduled-task/</link>
		<comments>http://support.risualblogs.com/blog/2011/12/01/running-exchange-powershell-as-scheduled-task/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 14:52:22 +0000</pubDate>
		<dc:creator>paulw</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/12/01/running-exchange-powershell-as-scheduled-task/</guid>
		<description><![CDATA[If you want to run any of the Exchange PowerShell commands from a standard PowerShell environment then you simply need to add in the following line in order to run it as if it is an Exchange Management Console: Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 For example, the script below will output the size of the Exchange Databases to [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to run any of the Exchange PowerShell commands from a standard PowerShell environment then you simply need to add in the following line in order to run it as if it is an Exchange Management Console:</p>
<p><strong>Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010</strong></p>
<p>For example, the script below will output the size of the Exchange Databases to a file and can be run as a scheduled task:</p>
<p>&nbsp;</p>
<p><em>Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010</em></p>
<p><em>Get-MailboxDatabase –Status | fl name, databasesize | out-file C:\dbsize.txt </em></p>
<p>&nbsp;</p>
<p>What we can do then is save the above script to a .ps1 file and then edit the action to start PowerShell.exe and put the arguments as the script that you want to run:</p>
<p><a href="http://support.risualblogs.com/blog/files/2011/12/image.png"><img style="padding-left: 0px;padding-right: 0px;float: none;margin-left: auto;margin-right: auto;padding-top: 0px;border: 0px" src="http://support.risualblogs.com/blog/files/2011/12/image_thumb.png" border="0" alt="image" width="394" height="214" /></a></p>
<p>This can be set up with the usual Scheduled Task settings and with the PowerShell snap-in for Exchange added in should be able to use the Exchange PowerShell commands.</p>
<p>Cheers</p>
<p>Paul</p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/12/01/running-exchange-powershell-as-scheduled-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing Users using PowerShell</title>
		<link>http://support.risualblogs.com/blog/2011/11/03/importing-users-using-powershell/</link>
		<comments>http://support.risualblogs.com/blog/2011/11/03/importing-users-using-powershell/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 09:48:53 +0000</pubDate>
		<dc:creator>paulw</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/11/03/importing-users-using-powershell/</guid>
		<description><![CDATA[We had a request from on of our clients where they wanted to create new user accounts for around 50 new employees. In order to do this we created a simple PowerShell script that used a populated CSV file to create the users in a certain OU and with a default password. The CSV file [...]]]></description>
			<content:encoded><![CDATA[<p>We had a request from on of our clients where they wanted to create new user accounts for around 50 new employees. In order to do this we created a simple PowerShell script that used a populated CSV file to create the users in a certain OU and with a default password. </p>
<p>The CSV file had the following headings:</p>
<p><a href="http://support.risualblogs.com/blog/files/2011/11/image.png"><img style="border-bottom: 0px;border-left: 0px;padding-left: 0px;padding-right: 0px;border-top: 0px;border-right: 0px;padding-top: 0px" border="0" alt="image" src="http://support.risualblogs.com/blog/files/2011/11/image_thumb.png" width="473" height="223" /></a></p>
<p>After saving it to a location we ran the following PowerShell script that created the users:</p>
<p>&#160;</p>
<p><em>import-module activedirectory     <br />$inputFile = Import-CSV&#160; <strong>C:\usersToBeCreated.csv</strong></em></p>
<p><em>foreach($line in $inputFile)     <br />{      <br />new-aduser -SamAccountName $line.UserName -Name $line.FullName -AccountPassword (ConvertTo-SecureString -AsPlainText &quot;<strong>Password</strong>&quot; -Force) -Enabled $true -Path &quot;<strong>OU=Domain Users,DC=TEST,dc=LOCAL</strong>&quot; -DisplayName $line.FullName -GivenName $line.FirstName -Surname $line.SurName -UserPrincipalName $line.UserPrincipalName -ChangePasswordAtLogon $True      <br />}</em></p>
<p>&#160;</p>
<p>You can copy and paste the script above where you will only need to change the bold text which is the CSV location, the temporary password for the new users and the OU that you want to put the users into. </p>
<p>As long as you use the same headings in your CSV file then this should work ok. You can, of course add in more details that are accepted by the <strong>new-aduser </strong>command which are outlined in the URL below: </p>
<p><a title="http://technet.microsoft.com/en-us/library/ee617253.aspx" href="http://technet.microsoft.com/en-us/library/ee617253.aspx">http://technet.microsoft.com/en-us/library/ee617253.aspx</a></p>
<p>Cheers</p>
<p>Paul </p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/11/03/importing-users-using-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Remote Reboot via PowerShell</title>
		<link>http://support.risualblogs.com/blog/2011/08/19/remote-reboot-via-powershell/</link>
		<comments>http://support.risualblogs.com/blog/2011/08/19/remote-reboot-via-powershell/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 15:27:35 +0000</pubDate>
		<dc:creator>Jovan Davis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/08/19/remote-reboot-via-powershell/</guid>
		<description><![CDATA[Below is PowerShell command which can be run to force a reboot on a remote machine: (gwmi win32_operatingsystem -ComputerName ComputerName -cred (get-credential)).Win32Shutdown(6)]]></description>
			<content:encoded><![CDATA[<p>Below is PowerShell command which can be run to force a reboot on a remote machine:</p>
<p>(gwmi win32_operatingsystem -ComputerName <strong>ComputerName</strong> -cred (get-credential)).Win32Shutdown(6)</p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/08/19/remote-reboot-via-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Record your PowerShell session</title>
		<link>http://support.risualblogs.com/blog/2011/08/10/record-your-powershell-session/</link>
		<comments>http://support.risualblogs.com/blog/2011/08/10/record-your-powershell-session/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 16:42:18 +0000</pubDate>
		<dc:creator>Daniel Davies</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/08/10/record-your-powershell-session/</guid>
		<description><![CDATA[There is a quick way to record your session in PowerShell to a text file so you have a record of every command you have typed. In PowerShell run the following command (Change location to wherever you would like) Start-Transcript c:\Powershell.txt –Append Now use PowerShell as you usually would, once you have finished with PowerShell [...]]]></description>
			<content:encoded><![CDATA[<p>There is a quick way to record your session in PowerShell to a text file so you have a record of every command you have typed.</p>
<p>In PowerShell run the following command (<strong><span style="color: #ff0000">Change location to wherever you would like</span></strong>)</p>
<p><strong>Start-Transcript <span style="color: #ff0000">c:\Powershell.txt</span> –Append</strong></p>
<p>Now use PowerShell as you usually would, once you have finished with PowerShell run the following command “<strong>Stop-Transcript”</strong></p>
<p>If you now open the “<strong><span style="color: #ff0000">PowerShell.txt</span></strong>” you will see everything you have just done in your PowerShell session.</p>
<p><strong>**********************<br />
**********************<br />
Windows PowerShell Transcript Start<br />
Start time: 20110810173323<br />
Username  : Test<br />
Machine      : Test (Microsoft Windows NT 6.1.7600.0)<br />
**********************<br />
Transcript started, output file is c:\MySession.txt<br />
[PS] C:\&gt;Get-Mailbox –Identity Dan</strong></p>
<p><strong>Name                     Alias                ServerName<br />
&#8212;-                         &#8212;&#8211;                 &#8212;&#8212;&#8212;-<br />
Dan                        Dan                  Test </strong></p>
<p><strong>[PS] C:\&gt;Get-User -Identity risual</strong></p>
<p><strong>Name               RecipientType<br />
&#8212;-                   &#8212;&#8212;&#8212;&#8212;-<br />
Dan                  UserMailbox </strong></p>
<p><strong>[PS] C:\&gt;Stop-Transcript</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/08/10/record-your-powershell-session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote Shutdown via PowerShell</title>
		<link>http://support.risualblogs.com/blog/2011/07/11/remote-shutdown-via-powershell/</link>
		<comments>http://support.risualblogs.com/blog/2011/07/11/remote-shutdown-via-powershell/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 08:43:38 +0000</pubDate>
		<dc:creator>Jovan Davis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/07/11/remote-shutdown-via-powershell/</guid>
		<description><![CDATA[Below is PowerShell command which can be run to force shutdown on a remote machine: (gwmi win32_operatingsystem -ComputerName ComputerName -cred (get-credential)).Win32Shutdown(5)]]></description>
			<content:encoded><![CDATA[<p>Below is PowerShell command which can be run to force shutdown on a remote machine:</p>
<p>(gwmi win32_operatingsystem -ComputerName <strong>ComputerName</strong> -cred (get-credential)).Win32Shutdown(5)</p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/07/11/remote-shutdown-via-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Exchange 2010 Mailbox Sizes in One Command</title>
		<link>http://support.risualblogs.com/blog/2011/06/22/exchange-2010-mailbox-sizes-in-one-command/</link>
		<comments>http://support.risualblogs.com/blog/2011/06/22/exchange-2010-mailbox-sizes-in-one-command/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 12:05:28 +0000</pubDate>
		<dc:creator>paulw</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/06/22/exchange-2010-mailbox-sizes-in-one-command/</guid>
		<description><![CDATA[Here is a good command to use if you want to find out the size of all your mailbox databases in Exchange 2010: Get-MailboxDatabase –Status &#124; fl name, databasesize It should output something similar to this: You can simply copy and paste the above command into an Exchange 2010 PowerShell window and run. Hope this [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a good command to use if you want to find out the size of all your mailbox databases in Exchange 2010:</p>
<p><strong>Get-MailboxDatabase –Status | fl name, databasesize</strong></p>
<p>It should output something similar to this:</p>
<p><a href="http://support.risualblogs.com/blog/files/2011/06/image2.png"><img style="border-bottom: 0px;border-left: 0px;padding-left: 0px;padding-right: 0px;border-top: 0px;border-right: 0px;padding-top: 0px" border="0" alt="image" src="http://support.risualblogs.com/blog/files/2011/06/image_thumb2.png" width="250" height="336" /></a></p>
<p>You can simply copy and paste the above command into an Exchange 2010 PowerShell window and run. Hope this helps.</p>
<p>Paul </p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/06/22/exchange-2010-mailbox-sizes-in-one-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable/Disable a Service via PowerShell</title>
		<link>http://support.risualblogs.com/blog/2011/06/13/enabledisable-a-service-via-powershell/</link>
		<comments>http://support.risualblogs.com/blog/2011/06/13/enabledisable-a-service-via-powershell/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 08:21:14 +0000</pubDate>
		<dc:creator>Daniel Davies</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/06/13/enabledisable-a-service-via-powershell/</guid>
		<description><![CDATA[Here’s a few quick PowerShell commands that will allow you to Disable or Enable a Service and Start or Stop a particular service. To Enable a particular service run the following command. (Please Edit ServiceName to the desired service) Set-Service ServiceName -StartupType Automatic To Disable a particular service run the following command. Set-Service ServiceName -StartupType [...]]]></description>
			<content:encoded><![CDATA[<p>Here’s a few quick PowerShell commands that will allow you to Disable or Enable a Service and Start or Stop a particular service.</p>
<p>To Enable a particular service run the following command. (Please Edit <span style="color: #ff0000"><strong>ServiceName</strong></span> to the desired service)</p>
<p><strong>Set-Service <span style="color: #ff0000">ServiceName</span> -StartupType Automatic</strong></p>
<p>To Disable a particular service run the following command.</p>
<p><strong>Set-Service <span style="color: #ff0000">S</span><span style="color: #ff0000">erviceName</span> -StartupType Disabled</strong></p>
<p>To Stop a particular service run the following command.</p>
<p><strong>Stop-Service <span style="color: #ff0000">ServiceName</span></strong></p>
<p>To Start a particular service run the following command.</p>
<p><strong>Start-Service <span style="color: #ff0000">ServiceName</span></strong></p>
<p>You can also combine the commands in a ps1 file , for example if you want to Disable and Stop a Service you would run the following.</p>
<p><strong>“Set-Service <span style="color: #ff0000">ServiceName</span> -StartupType Disabled<br />
Stop-Service <span style="color: #ff0000">ServiceName”</span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/06/13/enabledisable-a-service-via-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Force Logoff on Remote Machine Via PowerShell</title>
		<link>http://support.risualblogs.com/blog/2011/06/08/force-logoff-on-remote-machine-via-powershell/</link>
		<comments>http://support.risualblogs.com/blog/2011/06/08/force-logoff-on-remote-machine-via-powershell/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 13:53:16 +0000</pubDate>
		<dc:creator>Daniel Davies</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/06/08/force-logoff-on-remote-machine-via-powershell/</guid>
		<description><![CDATA[Just a quick command here to logoff remote machines via PowerShell “(gwmi win32_operatingsystem -ComputerName ComputerName -cred (get-credential)).Win32Shutdown(4)” This will log every user off the machine specified above.]]></description>
			<content:encoded><![CDATA[<p>Just a quick command here to logoff remote machines via PowerShell</p>
<p>“(gwmi win32_operatingsystem -ComputerName <strong>ComputerName</strong> -cred (get-credential)).Win32Shutdown(4)”</p>
<p>This will log every user off the machine specified above.</p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/06/08/force-logoff-on-remote-machine-via-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run PowerShell Script Remotely</title>
		<link>http://support.risualblogs.com/blog/2011/06/02/run-powershell-script-remotely/</link>
		<comments>http://support.risualblogs.com/blog/2011/06/02/run-powershell-script-remotely/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 10:02:21 +0000</pubDate>
		<dc:creator>Daniel Davies</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/06/02/run-powershell-script-remotely/</guid>
		<description><![CDATA[If you have PowerShell 2.0 installed on machines in your environment, then you are able to execute PowerShell scripts on remote machines straight from your local machine. First make sure you enable remote script execution on your Local and Remote machine by running the following in PowerShell. Enable-PSRemoting –force Now place the PowerShell script you [...]]]></description>
			<content:encoded><![CDATA[<p>If you have PowerShell 2.0 installed on machines in your environment, then you are able to execute PowerShell scripts on remote machines straight from your local machine.</p>
<p>First make sure you enable remote script execution on your Local and Remote machine by running the following in PowerShell.</p>
<p><strong><span style="font-size: x-small">Enable-PSRemoting –force</span></strong></p>
<p><span style="font-size: x-small">Now place the PowerShell script you want to execute on a location on your local machine.</span></p>
<p>Now we can run the following PowerShell command to execute the script on the remote machine <img class="wlEmoticon wlEmoticon-smile" style="border-style: none" src="http://support.risualblogs.com/blog/files/2011/06/wlEmoticon-smile.png" alt="Smile" /> (Edit the below highlighted in red to match the remote machine name and the PowerShell file location)</p>
<p><strong>Invoke-Command -ComputerName <span style="color: #ff0000">machinename</span> -FilePath <span style="color: #ff0000">C:\FileLocation\filename.ps1</span></strong></p>
<p><span style="font-size: x-small"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/06/02/run-powershell-script-remotely/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange PowerShell command to show permissions on a particular or all users mailboxes</title>
		<link>http://support.risualblogs.com/blog/2011/04/28/exchange-powershell-command-to-show-permissions-on-a-particular-or-all-users-mailboxes/</link>
		<comments>http://support.risualblogs.com/blog/2011/04/28/exchange-powershell-command-to-show-permissions-on-a-particular-or-all-users-mailboxes/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 10:18:21 +0000</pubDate>
		<dc:creator>Daniel Davies</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://support.risualblogs.com/blog/2011/04/28/exchange-powershell-command-to-show-permissions-on-a-particular-or-all-users-mailboxes/</guid>
		<description><![CDATA[We had a request recently to list what users have rights to a specific users mailbox. This can easily be done using the following command. Get-MailboxPermission –Identity “UserName” &#124; fl user, accessrights This gives an output like below. If you would like to see permissions for every users mailbox run the following command Get-MailboxPermission -Identity [...]]]></description>
			<content:encoded><![CDATA[<p>We had a request recently to list what users have rights to a specific users mailbox.</p>
<p>This can easily be done using the following command.</p>
<p><strong>Get-MailboxPermission –Identity “UserName” | fl user, accessrights</strong></p>
<p>This gives an output like below.</p>
<p><a href="http://support.risualblogs.com/blog/files/2011/04/image29.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://support.risualblogs.com/blog/files/2011/04/image_thumb29.png" border="0" alt="image" width="346" height="37" /></a></p>
<p>If you would like to see permissions for every users mailbox run the following command</p>
<p><span style="color: #555555"><strong>Get-MailboxPermission -Identity * | fl user, accessrights , identity &gt; <span style="color: #ff0000">C:\Perms.txt<br />
</span></strong></span><strong><span style="color: #ff0000">(You can change the file location to wherever you would like)</span></strong></p>
<p>The list of the Users and Permissions will all be in the Perms.txt file.</p>
]]></content:encoded>
			<wfw:commentRss>http://support.risualblogs.com/blog/2011/04/28/exchange-powershell-command-to-show-permissions-on-a-particular-or-all-users-mailboxes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

