Home
- Details
- Written by: po3dno
- Category: Exchange Server
- Hits: 1009
When you change AutoDiscover settings for users, it can take up to 2 hours until the cached data on each Exchange Server is invalidated and the new AutoDiscover configuration is sent as a response to new AutoDiscover request.
You have to force a service and a application pool restart to activate your configuration changes immediately:
- Service: MSExchangeServiceHost
- Application Pool: MSExchangeAutodiscoverAppPool
These restarts need to be performed on each Exchange 2013/2016 server in your infrastructure serving AutoDiscover requests.
Use the following two PowerShell cmdlets to simplify this task:
Get-ExchangeServer | ? { $_.AdminDisplayVersion -like '*15.*'} | % { Invoke-Command -ComputerName $_.Name -ScriptBlock {Restart-WebAppPool MSExchangeAutodiscoverAppPool } }
Get-ExchangeServer | ? { $_.AdminDisplayVersion -like '*15.*'} | % { Invoke-Command -ComputerName $_.Name -ScriptBlock {Restart-Service MSExchangeServiceHost } }
- Details
- Written by: po3dno
- Category: Perl
- Hits: 980
sub calcuac {
my $result = "";
my $curuac = $_[0];
my %hash = (
DONT_EXPIRE_PASSWORD => 65536,
NORMAL_ACCOUNT => 512,
TEMP_DUPLICATE_ACCOUNT => 256,
ENCRYPTED_TEXT_PWD_ALLOWED => 128,
PASSWD_CANT_CHANGE => 64,
PASSWD_NOTREQD => 32,
LOCKOUT => 16,
ACCOUNTDISABLE => 2,
);
my $i = 0;
for my $key (sort {$hash{$b} <=> $hash{$a}} keys %hash ) {
if ($curuac >= $hash{$key}){
$result = $result . " \| " if ($i > 0);
$curuac = $curuac - $hash{$key};
$result = $result . $key;
$i++;
}
}
return $result;
}
- Details
- Written by: po3dno
- Category: Power Shell
- Hits: 924
Наиболее простой путь сконфигурировать удаленное управление это выполнить Enable-PSRemoting в оболочке powershell с правами администратора. При этом произойдет следущее:
- запустится служба WinRM (если запущена перезапустится)
- служба WinRM перейдет в состояние — автоматический запуск при старте
- будет создан прослушиватель WinRM для HTTP трафика на порту 5985 для всех локальных IP адресов
- будет создано правило файрвола для прослушивателя WinRM. Внимание, этот пункт завершится с ошибкой если любая из сетевых карточек имеет тип сети «публичная», т.к. открывать порт на такой карточке не хорошо. Если у вас при конфигурировании вышла такая ошибка измените профиль это сетевушки командлетом Set-NetConnectionProfile и после этого запустите Enable-PSRemoting снова. Если вам нужна сетевая карточка с профилем «Публичная сеть» запустите Enable-PSRemoting с параметром -SkipNetworkProfileCheck в этом случае будут созданы правила файрвола только из локальной сети.
- Details
- Written by: po3dno
- Category: Other
- Hits: 959
To enable logging in the Gpsvc.log file, follow these steps.
1. Click Start , click Run , type regedit , and then click OK .
2. Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersion
3. On the Edit menu, point to New , and then click Key .
4. Type Diagnostics , and then press ENTER.
5. Right-click the Diagnostics subkey, point to New , and then click DWORD Value .
6. Type GPSvcDebugLevel , and then press ENTER.
7. Right-click GPSvcDebugLevel , and then click Modify .
8. In the Value data box, type 0x30002 , and then click OK .
9. Exit Registry Editor.
10. At a command prompt, type the following command, and then press ENTER:
gpupdate /force
11. View the Gpsvc.log file in the following folder:
%windir%debugusermode
- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 1013
USE SUSDB
GO
DELETE FROM tbEventInstance WHERE EventNamespaceID = '2' AND EVENTID IN ('381', '382', '384', '386', '387', '389')
EXEC SUSDB.dbo.spDeclineExpiredUpdates;1
EXEC SUSDB.dbo.spDeclineSupersededUpdates;1
Для команды spCompressUpdate используется «обёртка»:
USE SUSDB
DECLARE @var1 INT, @curitem INT, @totaltodelete INT
DECLARE @msg nvarchar(200)
CREATE TABLE #results (Col1 INT) INSERT INTO #results(Col1)
EXEC spGetUpdatesToCompress
SET @totaltodelete = (SELECT COUNT(*) FROM #results)
SELECT @curitem=1
DECLARE WC Cursor FOR SELECT Col1 FROM #results
OPEN WC
FETCH NEXT FROM WC INTO @var1 WHILE (@@FETCH_STATUS > -1)
BEGIN SET @msg = cast(@curitem as varchar(5)) + '/' + cast(@totaltodelete as varchar(5)) + ': Compressing ' + CONVERT(varchar(10), @var1) + ' ' + cast(getdate() as varchar(30))
RAISERROR(@msg,0,1) WITH NOWAIT
EXEC spCompressUpdate @localUpdateID=@var1
SET @curitem = @curitem +1
FETCH NEXT FROM WC INTO @var1
END
CLOSE WC
DEALLOCATE WC
DROP TABLE #results
Такая же обертка для spDeleteUpdate:
USE SUSDB
DECLARE @var1 INT, @curitem INT, @totaltodelete INT
DECLARE @msg nvarchar(200)
CREATE TABLE #results (Col1 INT) INSERT INTO #results(Col1)
EXEC spGetObsoleteUpdatesToCleanup
SET @totaltodelete = (SELECT COUNT(*) FROM #results)
SELECT @curitem=1
DECLARE WC Cursor FOR SELECT Col1 FROM #results
OPEN WC
FETCH NEXT FROM WC INTO @var1 WHILE (@@FETCH_STATUS > -1)
BEGIN SET @msg = cast(@curitem as varchar(5)) + '/' + cast(@totaltodelete as varchar(5)) + ': Deleting ' + CONVERT(varchar(10), @var1) + ' ' + cast(getdate() as varchar(30))
RAISERROR(@msg,0,1) WITH NOWAIT
EXEC spDeleteUpdate @localUpdateID=@var1
SET @curitem = @curitem +1
FETCH NEXT FROM WC INTO @var1
END
CLOSE WC
DEALLOCATE WC
DROP TABLE #results
/****************************************************************************** This sample T-SQL script performs basic maintenance tasks on SUSDB 1. Identifies indexes that are fragmented and defragments them. For certain tables, a fill-factor is set in order to improve insert performance. Based on MSDN sample at http://msdn2.microsoft.com/en-us/library/ms188917.aspx and tailored for SUSDB requirements 2. Updates potentially out-of-date table statistics. ******************************************************************************/