2015年12月28日 星期一

Check Exchange 版本

Get-Command Exsetup.exe | ForEach-Object {$_.FileVersionInfo}




RU0
14.03.0123.004   14.03.0123.004

RU12
14.03.0279.002   14.03.0279.002


2015年12月24日 星期四

2015年10月20日 星期二

disable Windows Firewall with PowerShell in Windows Server 2012


Get-NetFirewallProfile | Set-NetFirewallProfile –Enabled False

Windows10 開始失效 釘選失效

Get-AppxPackage | % { Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppxManifest.xml" -verbose }

ResetSearchIndex

OWA 搜尋錯誤


cd\Program Files\Microsoft\Exchange Server\V14\Scripts
.\ResetSearchIndex.ps1 -force 15F
.\ResetSearchIndex.ps1 -force "16D"
.\ResetSearchIndex.ps1 -force 17E
.\ResetSearchIndex.ps1 -force 18G

get sid windows7

wmic useraccount where name='administrator' get sid




Get SID of a local user
wmic useraccount where name='username' get sid

For example, to get the SID for a local user with the login name  ‘John’, the command would be as below
wmic useraccount where name='John' get sid

Get SID for current logged in user

To retrieve the SID for current logged in user we can run the below command. This does not require you to specify the user name in the command. This can be used in batch files which may be executed from different user accounts.
wmic useraccount where name='%username%' get sid

Get SID for current logged in domain user

Run the command ‘whoami /user’ from command line to get the SID for the logged in user.
 Example:
c:\>whoami /user
USER INFORMATION
----------------
User Name      SID
============== ==============================================
mydomain\wincmd S-1-5-21-7375663-6890924511-1272660413-2944159
c:\>

Get SID for the local administrator of the computer
wmic useraccount where (name='administrator' and domain='%computername%') get name,sid

Get SID for the domain administrator
wmic useraccount where (name='administrator' and domain='%userdomain%') get name,sid

jump-lists-reset-clear

:: Created by: Shawn Brink
:: http://www.eightforums.com
:: Tutorial:  http://www.eightforums.com/tutorials/9611-jump-lists-reset-clear-windows-8-a.html


del /F /Q %APPDATA%\Microsoft\Windows\Recent\*

del /F /Q %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*

del /F /Q %APPDATA%\Microsoft\Windows\Recent\CustomDestinations\*

taskkill /f /im explorer.exe

start explorer.exe

Windows10 health Check

Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth
sfc /scannow

2015年3月11日 星期三

DeliverToMailboxAndForward 轉寄信件至信箱





Get-Mailbox -resultSize unlimited |where {$_.deliverTomailboxAndForward -eq '$true'}| Set-mailbox  -deliverTomailboxAndForward $False




Set-Mailbox -Identity "some user" -ForwardingAddress some.user@contoso.com -DeliverToMailboxAndForward $False
and to get a list of those users

get-mailbox -ResultSize unlimited | where {$_.delivertomailboxandforward -eq $true}|select Name, Samaccountname | export-csv c:\mailandforward.csv