Windows Server 2012 – PowerShell WebAccess

Import-Module ServerManager
Install-WindowsFeature WindowsPowerShellWebAccess
Get-Help *pswa*

#For testing only:
Install-PswaWebApplication -UseTestCertificate
Add-PswaAuthorizationRule * * *

# In reality, buy a certification and configure some security:
# Add-PswaAuthorizationRule -ComputerName SERVER-NAME-001
# Add-PswaAuthorizationRule -UserGroupName SECURITY-GROUP-001
# Add-PswaAuthorizationRule -ConfigurationName WHAT-CMDLETS-POLICY

 


Reference:
http://technet.microsoft.com/en-us/library/hh831611.aspx

Advertisements

Exchange – Device Related Cmdlets

Exchange 2010 – Get-ActiveSyncDevice:
http://technet.microsoft.com/en-us/library/dd335068(v=exchg.150).aspx

Exchange 2013 – Get-MobileDevice:
http://technet.microsoft.com/en-us/library/jj218706(v=exchg.150).aspx

Differences:
http://exchangeserverpro.com/mobile-device-management-cmdlets-exchange-2013/

Get-ActiveSyncDevice is deprecated for Get-MobileDevice.
A Task-Based Guide to Windows PowerShell Cmdlets:
http://technet.microsoft.com/en-us/scriptcenter/dd772285.aspx

PowerShell – Fun With Loading $Profile

If you run $profile, you will get a path returned similar to the following:
C:\Users\<USERNAME>\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1

If you have a .ps1 with the file name, you can pre-load or execute scripts upon launching PowerShell.

For example, check out the following. PowerShell can greet you based on the time of day:

Add-Type -AssemblyName System.Speech
$name = [Environment]::UserName
$theTime = (Get-Date).Hour

if ($theTime -le 12)
   {
       [string]$theGreeting = "Good morning "
   }
if (($theTime -ge 12) -and ($theTime -le 18))
   {
     [string] $theGreeting = "Good afternoon "
   }
if (($theTime -ge 19) -and ($theTime -le 24))
   {
      [string]$theGreeting = "Good evening "
   }

$theVoice = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer 
$theVoice.Speak("$theGreeting $name")

Reference:
http://technet.microsoft.com/en-us/library/ff730960.aspx

Powershell – Disable Windows Firewall

Older netsh advfirewall set allprofiles state off is to be deprecated in favor of PowerShell.

For testing, you can disable all Windows Firewall Profiles with the following PowerShell commands:

Import-Module NetSecurity
Get-NetFirewallProfile | Set-NetFirewallProfile -Enabled False

To re-enable:

Get-NetFirewallProfile | Set-NetFirewallProfile -Enabled True