Install Languagepack to win 7 prof or home.
dism /online /add-package /packagepath:G:\langpacks\de-de\lp.cab
bcdedit /set {current} locale de-DE
bcdboot %WinDir% /l de-DE
REG DELETE HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\En-US /f
to switch back to ang, remove de-de reg key and add ang.
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\en-US /f /v LCID /t REG_DWORD /d 00000409 REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MUI\UILanguages\en-US /f /v Type /t REG_DWORD /d 00000091
--------------------------
By default in Exchange 2010 SP1, only 10 devices (=EAS PartnerShips) is allowed.
This setting is found in the Default ThrottlingPolicy (Get-ThrottlingPolicy Default*| fl Name,EASMaxDevices) and can be changed as desired.
Example: Set-ThrottlingPolicy Default* -EASMaxDevices 1
--------------------------
Import PST files to Exchange mailbox
New-MailboxImportRequest -FilePath \\server\PST\charter.pst -AcceptLargeDataLoss -BadItemLimit unlimited -Mailbox charter -TargetRootFolder "OLD Mail"
-------------------------
add user from one group to another
Get-ADGroupMember "group1" | Get-ADUser | Foreach-Object {Add-ADGroupMember -Identity "group2" -Members $_}
---------------
Set all virtual direcotry to same name
#ChangeAutodiscoverPath.ps1
#Changing InternalURL Path
$urlpath = Read-Host "Type Internal Client Access FQDN starting with http:// or https://"
Set-AutodiscoverVirtualDirectory -Identity * –internalurl “$urlpath/autodiscover/autodiscover.xml”
Set-ClientAccessServer –Identity * –AutodiscoverServiceInternalUri “$urlpath/autodiscover/autodiscover.xml”
Set-webservicesvirtualdirectory -Identity * –internalurl “$urlpath/ews/exchange.asmx”
Set-oabvirtualdirectory –Identity * –internalurl “$urlpath/oab”
Set-owavirtualdirectory –Identity * –internalurl “$urlpath/owa”
Set-ecpvirtualdirectory –Identity * –internalurl “$urlpath/ecp”
Set-ActiveSyncVirtualDirectory -Identity * -InternalUrl "$urlpath/Microsoft-Server-ActiveSync"
#Changing ExternalURL Path
$urlpath2 = Read-Host "Type External Client Access FQDN starting with http:// or https://"
Set-AutodiscoverVirtualDirectory -Identity * –externalurl “$urlpath2/autodiscover/autodiscover.xml”
Set-ClientAccessServer –Identity * –AutodiscoverServiceInternalUri “$urlpath2/autodiscover/autodiscover.xml”
Set-webservicesvirtualdirectory –Identity * –externalurl “$urlpath2/ews/exchange.asmx”
Set-oabvirtualdirectory –Identity * –externalurl “$urlpath2/oab”
Set-owavirtualdirectory –Identity * –externalurl “$urlpath2/owa”
Set-ecpvirtualdirectory –Identity * –externalurl “$urlpath2/ecp”
Set-ActiveSyncVirtualDirectory -Identity * -ExternalUrl "$urlpath/Microsoft-Server-ActiveSync"
#get commands to doublecheck the config
get-AutodiscoverVirtualDirectory | fl identity,internalurl, externalurl
get-ClientAccessServer | fl identity,AutodiscoverServiceInternalUri
get-webservicesvirtualdirectory | fl identity,internalurl,externalurl
get-oabvirtualdirectory | fl identity,internalurl,externalurl
get-owavirtualdirectory | fl identity,internalurl,externalurl
get-ecpvirtualdirectory | fl identity,internalurl,externalurl
get-ActiveSyncVirtualDirectory | fl identity,internalurl,externalurl
-----------------------------
Multiple domain autodiscover to single point (exchange)
http://www.msexchange.org/articles-tutorials/exchange-server-2010/mobility-client-access/using-autodiscover-large-numbers-accepted-domains-part1.html
Header remove
Get-SendConnector| Remove-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights ms-Exch-Send-Headers-Routing
----------------------------
#Export PTS without online archiv
Clear-Variable destination
Clear-Variable exportDatabase
Clear-Variable mailboxyProExport
Clear-Variable exportmailbox
$destination = Read-Host "Type export path (\\server\share or c:\exportfolder) :"
Get-MailboxDatabase
$exportDatabase = Read-Host "Type Database for Export (or left black if you want to export all mailbox) :"
if ($exportDatabase){
Get-Mailbox -Database "$exportDatabase" | FT alias,displayname
$exportmailbox = Read-Host "Type mailbox for Export (or left black if you want to export all mailbox in database) :"
}
if ($exportDatabase){
if ($exportmailbox) {$mailboxyProExport = Get-Mailbox $exportmailbox | %{$_.displayname} }
else { $mailboxyProExport = Get-Mailbox -Database "$exportDatabase" | %{$_.displayname} }
}
else { $mailboxyProExport = Get-Mailbox | %{$_.displayname} }
if($mailboxyProExport){
foreach($mailbox in $mailboxyProExport){
Write-Host $mailbox
#nactení primární adresy
$mail = (get-mailbox $mailbox).primarysmtpaddress.toString()
#Vytvorení požadavku na export
$export = New-MailboxExportRequest -Name Export -FilePath "$destination\Export_$mail.pst" -Mailbox $mailbox
#cekání na dokoncení exportu
do{start-sleep 10}until(@("Completed","Failed") -contains (Get-MailboxExportRequest -name Export).status)
#smazání dokonceného exportu
Get-MailboxExportRequest -name Export | remove-mailboxExportRequest -confirm:$false
}
}
---------------------------
MOVE all system mailbox
Get-Mailbox -Database "Mailbox Database 0575157523" | New-MoveRequest -TargetDatabase DB1
Get-Mailbox -AuditLog|New-MoveRequest -TargetDatabase DB1
Get-Mailbox -Monitoring|New-MoveRequest -TargetDatabase DB1
Get-Mailbox -Arbitration| New-MoveRequest -TargetDatabase DB1
Get-MoveRequest|Remove-MoveRequest
Broken DFSR - obsolated
To get things back in order, do the following:
1. Start DFSMGMT.MSC on the affected server.
2. On any affected replication groups this server is a member of, select the computer on the Membership tab and "Disable" it.
3. Accept the warning prompt.
4. If the reason for replication never occurring was the schedule being set to "no replication" on the RG or RF, or no bi-directional connections being place between servers, fix that situation now.
wmic.exe /namespace:\\root\microsoftdfs path DfsrMachineConfig set MaxOfflineTimeInDays=60
5. Force AD Replication and verify it has converged.
6. On the affected server, run:
DFSRDIAG.EXE POLLAD
7. Wait for the 4008 and 4114 events being written to the DFSR event log to confirm that the replicated folder(s) are no longer being replicated.
8. In DFSMGMT.MSC, "Enable" the replication again on the affected replicated folders for that server.
9. Force AD replication and POLLAD again.
-------------------------------------------------------------------
Transfer all GPO (backup restore by names)
Get-GPO -All | % {
$name = $_.DisplayName
$dir = New-Item "C:\backup\$name" -Type Directory
Backup-GPO -Guid $_.Id -Path $dir
}
Get-ChildItem "C:\backup" | % {
$name = $_.name
$id = (get-childitem $_) -replace '[{}]', ''
$cesta= "c:\backup\"+$name
Import-GPO -BackupId $id -TargetName $name -path "$cesta" -CreateIfNeeded
}
-------------------------------------------------------------
Migrate DHCP
netsh dhcp server \\localhost export c:\backupdhcp\dhcpdb
netsh dhcp server \\localhost import c:\backupdhcp\dhcpdb
------------------------------------------------------------
schema version detect:
dsquery * cn=schema,cn=configuration,dc=domainname,dc=local -scope base -attr objectVersion
exchange schema version detect:
dsquery * CN=ms-Exch-Schema-Version-Pt,cn=schema,cn=configuration,dc=domain,dc=local -scope base -attr rangeUpper
-----------------------------------------------
exchange add self to import export group
New-ManagementRoleAssignment -Name "Import_Export" -SecurityGroup "Enterprise Support" -Role "Mailbox Import Export"
New-ManagementRoleAssignment -Name "Import_Export" -user mailbox -Role "Mailbox Import Export"
----------------------------------------------
move domain roles
NetDOM /query FSMO
Move-ADDirectoryServerOperationMasterRole -Identity "PDC" -OperationMasterRole 0,1,2,3,4
PDCEmulator or 0
RIDMaster or 1
InfrastructureMaster or 2
SchemaMaster or 3
DomainNamingMaster or 4
----------------------------------------------
Windows 8 unistall some apps
Get-AppxPackage -AllUsers | Remove-AppxPackage
Get-AppXProvisionedPackage -online | Remove-AppxProvisionedPackage –online
Add-AppxPackage -register "C:\Program Files\WindowsApps\Microsoft.Windows.Photos_16.302.8200.0_x64__8wekyb3d8bbwe\appxmanifest.xml" -DisableDevelopmentMode
Get-AppxPackage -AllUsers |where {($_.Name -notlike '*Photo*' -and $_.Name -notlike '*Calculator*')}| Remove-AppxPackage
Get-AppXProvisionedPackage -online | where {($_.DisplayName -notlike '*Photo*' -and $_.DisplayName -notlike '* Calculator*')} |Remove-AppxProvisionedPackage –online
---------------------------------------------
eval version to full
DISM /online /Set-Edition:ServerStandarD /ProductKey: /AcceptEula
=========================
settings of out of office
Get-Mailbox | where {$_.HiddenFromAddressListsEnabled -eq $True}|Set-MailboxAutoReplyConfiguration -AutoReplyState enabled -ExternalAudience all -InternalMessage „NECO int“ -ExternalMessage „NECO ext“
------------------------------------------
last name first to generate username
CN=user-Display,CN=409,CN=DisplaySpecifiers,CN=Configuration,DC=mycorecloud,DC=net
create dialog = %<sn> %<givenName>
----------------------------------------------
public folder root permission default change
Get-PublicFolder -Identity \PublicFolder |Remove-PublicFolderClientPermission -user "Default"
Get-PublicFolder -Identity \PublicFolder |Add-PublicFolderClientPermission -user "Default" -AccessRights CreateItems
-------------------------------------------------
Safe Mode:
bcdedit /set {default} safeboot minimal
Safe Mode with Networking:
bcdedit /set {default} safeboot network
end safe boot
bcdedit /deletevalue {default} safeboot
-----------------------------------------
Reset default security setting on drive C (system drive)
secedit /configure /cfg %windir%\inf\defltbase.inf /db defltbase.sdb /verbose
----------------------------------------
w32tm /config /manualpeerlist:"tik.cesnet.cz tak.cesnet.cz" /syncfromflags:manual /update
----------------------------------------
%windir%\system32\Sysprep\Sysprep.exe /generalize /shutdown /oobe
/unattend:<file_name>
dism /online /Cleanup-Image /StartComponentCleanup
dism /online /Cleanup-Image /StartComponentCleanup /ResetBase
dism /online /Cleanup-Image /SPSuperseded
---------------------------------------
Get-ADOrganizationalUnit -Filter 'Name -like "*"' | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true
--------------------------------------------------------------------------------------------------------
Prepare domain for exchange
setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms
Setup.exe /PrepareAD /OrganizationName:"<organization name>" /IAcceptExchangeServerLicenseTerms
for child domains
Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms
----------------------------------------------------------------------------------------------------
globaly enable exchange mailbox
Get-User -DomainController "DC1FQDN" -OrganizationalUnit "OU=_Users,DC=domain,DC=net"|Enable-Mailbox -AddressBookPolicy "Address policy" -DomainController "DC1FQDN"
---
GPupdate force in domain
Get-ADComputer -filter * -Searchbase "cn=computers, dc=Contoso,dc=com" | foreach{ Invoke-GPUpdate -computer $_.name -force}
------------------------------------
allocation unit check
fsutil fsinfo ntfsinfo d:
-----------------------------------
delete wsus
Delete the entire registry key HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate
Reboot
------------------
DFS FQDN
Set-DfsnServerConfiguration –ComputerName localhost –UseFqdn $true
Stop-Service dfs; Start-Service dfs
------------
csv cache
# Get CSV Block Cache Size
(Get-Cluster).BlockCacheSize
# Set CSV Block Cache Size to 512MB
(Get-Cluster).BlockCacheSize = 512
----------------------------------------------
exchange external relay connector
annonimouse:
Get-ReceiveConnector "Relay name" | Add-ADPermission -User 'NT AUTHORITY\Anonymous Logon' -ExtendedRights MS-Exch-SMTP-Accept-Any-Recipient
------------------------------------
room mailbox subject
Get-Mailbox meetingroom -DomainController XXX|Set-CalendarProcessing -DomainController XXX -DeleteSubject $false
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
remove onedrive
@echo off
cls
set x86="%SYSTEMROOT%\System32\OneDriveSetup.exe"
set x64="%SYSTEMROOT%\SysWOW64\OneDriveSetup.exe"
echo Closing OneDrive process.
echo.
taskkill /f /im OneDrive.exe > NUL 2>&1
ping 127.0.0.1 -n 5 > NUL 2>&1
echo Uninstalling OneDrive.
echo.
if exist %x64% (
%x64% /uninstall
) else (
%x86% /uninstall
)
ping 127.0.0.1 -n 10 > NUL 2>&1
echo Removing OneDrive leftovers.
echo.
rd "%USERPROFILE%\OneDrive" /Q /S > NUL 2>&1
rd "C:\OneDriveTemp" /Q /S > NUL 2>&1
rd "%LOCALAPPDATA%\Microsoft\OneDrive" /Q /S > NUL 2>&1
rd "%PROGRAMDATA%\Microsoft OneDrive" /Q /S > NUL 2>&1
echo Removing OneDrive from the Explorer Side Panel.
echo.
REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > NUL 2>&1
REG DELETE "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > NUL 2>&1
pause
--------------
Credential manager
rundll32.exe keymgr.dll,KRShowKeyMgr
Exchange O365
Microsoft Online Service Sign-in Assistant for IT Professionals RTW
https://www.microsoft.com/en-us/download/details.aspx?id=41950
http://go.microsoft.com/fwlink/p/?linkid=236297
Set-ExecutionPolicy RemoteSigned
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
$Import = Import-Pssession $Session -AllowClobber
Import-Module MSOnline -verbose
Connect-MSOLservice -Credential $LiveCred
set-mailbox info@wfpse.cz -Type shared
get-mailbox
Start-service winrm
set-mailbox info@hiposeberov.cz -Type shared
Export from O365
Get-User | Export-Csv "C:\O365Export.csv" -NoTypeInformation -Encoding unicode
$Domain = “@domain.com"
$password = “Password"
$DomainPath= "OU=Users,DC=domain,DC=com"
Import-Csv "C:\O365Export.csv" | ForEach-Object{ $Domain; $UPN = $_.Identity+$Domain; New-ADUser -SamAccountName $_.Identity -UserPrincipalName $UPN -Name $_.Name -DisplayName $_.DisplayName -GivenName $_.FirstName -Initials $_.initials -Surname $_.LastName -Department $_.Department -Company $_.Company -Fax $_.Fax -City $_.City -State $_.StateOrProvince -PostalCode $_.PostalCode -Title $_.Title -EmailAddress $_.WindowsEmailAddress -Office $_.Office -OfficePhone $_.Phone -MobilePhone $_.MobilePhone -StreetAddress $_.StreetAddress -Path $DomainPath -AccountPassword (ConvertTo-SecureString $password -AsPlainText -Force) -Enabled $True -PasswordNeverExpires $True -PassThru }
https://oddytee.wordpress.com/2016/03/14/sync-new-active-directory-with-existing-office-365-tenant/
https://blogs.technet.microsoft.com/exchange/2015/03/03/want-more-control-over-sent-items-when-using-shared-mailboxes/
For emails Sent As the shared mailbox:
set-mailbox <mailbox name> -MessageCopyForSentAsEnabled $True
For emails Sent On Behalf of the shared mailbox:
set-mailbox <mailbox name> -MessageCopyForSendOnBehalfEnabled $True
Disable the feature
For messages Sent As the shared mailbox:
set-mailbox <mailbox name> -MessageCopyForSentAsEnabled $False
For emails Sent On Behalf of the shared mailbox:
set-mailbox <mailbox name> -MessageCopyForSendOnBehalfEnabled $False
Exchange available space in database
Get-MailboxDatabase -Status | select Name,DatabaseSize,AvailableNewMailboxSpace
DELETE office 365 user permanent
Get-MsolUser -ReturnDeletedUsers -UserPrincipalName xxx@abc.com|Remove-MsolUser -RemoveFromRecycleBin
IIS: config history
appcmd.exe set config -section:system.applicationHost/configHistory /enabled:"True" /commit:apphost
appcmd.exe set config -section:system.applicationHost/configHistory /path:"%SystemDrive%\inetpub\history" /commit:apphost
appcmd.exe set config -section:system.applicationHost/configHistory /maxHistories:"50" /commit:apphost
appcmd.exe set config -section:system.applicationHost/configHistory /period:"00:05:00" /commit:apphost
Make sure that the DsSvc.dll file exists in the %WinDir%\System32 folder
Sc config ualsvc type=own
Sc config dssvc type=own
WorkFolders:
By default, Work Folders supports up to 16 Sync Shares per Work Folders server. This is because the default number of JET databases that can be opened simultaneously is 16.
You can increase the number of JET databases by creating the EseParameterSettings registry value under the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SyncShareSvc\Settings
Value: EseParameterSettings
Type: REG_MULTI_SZ
Data:
[GLOBAL]
JET_paramMaxInstances=1024
For JET_paramMaxInstances, the maximum value is 1024.
After creating the registry value, restart the Windows Sync Share (SyncShareSvc) service.
Registry Value:
Note: We recommend limiting the number of users per Work Folders server to 5,000. See the performance considerations blog for more info:
https://blogs.technet.microsoft.com/filecab/2013/11/01/performance-considerations-for-work-folders-deployments/
$Customer="Customer"
#Predelani na VELKE pismena
$Customer=$Customer.ToUpper()
#Vytvoreni WorkFolders
New-SyncShare -Name $Customer -Path "D:\DATA\$Customer\USERS" -User "MYCORECLOUD\$Customer Users" -InheritParentFolderPermission -PasswordAutolockExcludeDomain "mycorecloud.net" -RequirePasswordAutoLock $True
Clear event log
wevtutil el | Foreach-Object {wevtutil cl "$_"}
Windows backup hangs - Removing Deleted Items
Clear all shadows:
vssadmin list shadows
vssadmin Delete Shadows /all
OR
Diskshadow
delete shadow all
-----------------------------
Change default OU persission
regsvr32 schmmgmt.dll
Expand the Active Directory Schema (Dcname1) and go to Classes section. In the class list, locate the class organizationalUnit, right-click on it and select Properties.
-----------------------------
Set mail and Proxy Address
$users = Get-ADUser -Filter * -SearchBase 'OU=Users,OU=cslegal.cz,OU=_CoreCloud,DC=MYCORE,DC=CLOUD' -Properties SamAccountName, ProxyAddresses, UserPrincipalName, Mail
Foreach ($user in $users) {
$user.mail = $user.UserPrincipalName
$mail=$user.mail
$user.ProxyAddresses.add("SMTP:$($mail)")
Set-ADUser -instance $user
}
Get Foft delete
Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -ne $null } | ft DisplayName,Database,DisconnectReason,DisconnectDate
Register multiple dll
FOR %1 IN (*.DLL) DO REGSVR32 /S %1
Get-Recipient -ResultSize unlimited| Where {$_.EmailAddresses -like "*@domain.com"} | FL DisplayName,EmailAddresses