Powershell : Cmdlet -> Alias (zkratky v Powershellu, které jste možná neznali )

Na Technet blogu nám všem co rádi používáme powershell přichystal Scripting Guy super tabulku Aliasů k Powershell Comandletům. Mrkněte na ně, určitě si některé oblíbíte. 🙂

http://blogs.technet.com/b/heyscriptingguy/archive/2015/06/11/table-of-basic-powershell-commands.aspx

 

PS1_Zkratky

 

Rubriky: Powershell | Komentáře nejsou povolené u textu s názvem Powershell : Cmdlet -> Alias (zkratky v Powershellu, které jste možná neznali )

MS SCOM 2007 R2 – Audit Reports

scom2007r2

If you need to create own audit reports in MS SQL Report Builder for MS SCOM, you need to know how do it in Report Builder. You need also know little bit about SQL  and better  to know about PL/SQL.

Usual target of your interest will be audit reports from AD (User logins ….). If you need to create own report for user logins, the point of your interest will be MS SQL view – AdtServer.dvAll located in OperationManagerAC database.

 

Table join for EventID on Server 2008 and newer

SELECT distinct
li.TargetDomain
,li.TargetUser
,li.PrimaryUser
,li.String06 GuiDID_li
,lo.String06 GuiDID_lo
,li.String01 as LogonType1
, li.EventMachine
, li.Source
, li.String13 as AuthPackage
, li.String12 as LogonProcess
, li.String03 as LogOnFrom
–, cast(CAST(li.CreationTime as time) as DATEtime) as LoginDateTime
–, dateadd(D,DATEDIFF(D,li.CreationTime, lo.CreationTime), cast(CAST(lo.CreationTime as time) as DATEtime)) as LogoutDateTime
–, CAST(li.CreationTime as time) as LoginTime
, li.CreationTime as LoginDate
, lo.CreationTime as LogoutDate
–, DATEDIFF(SECOND,li.CreationTime, lo.CreationTime) as diff
,li.String02 as LogonType2

FROM
(SELECT * FROM AdtServer.dvAll WHERE EventId = 4624) AS li LEFT OUTER JOIN
(SELECT * FROM AdtServer.dvAll WHERE EventId = 4634) AS lo
on li.String01 = lo.String01

WHERE li.EventId = 4624
and li.CreationTime > dateadd(DAY,-3,GETDATE())
and DATEDIFF(SECOND,li.CreationTime, lo.CreationTime) > 0
and li.TargetUser not like ‚%$‘
–and li.TargetUser = lo.TargetUser
–and li.String13 not like ‚MICROSOFT_AUTHENTICATION_PACKAGE_V1_0‘
and li.String06 not in (‚{00000000-0000-0000-0000-000000000000}‘)
–and li.String02 in (‚2′,’10‘)
and li.String02 in (‚2′,’10‘)
and li.TargetUser not like ‚/_%‘ escape ‚/‘
and li.TargetUser = ‚user‘
–and li.EventMachine = ‚dc2008‘

 

SCOMMSSQLREPORT2008

This description of strings could you little help, if your ACS agent are running on Windows Server 2008 and newer.:

, String01 as TargetLogonId
, String02 as LogonType
, String03 as LogOnFrom
, String04 as ipPort
, String05 as TargetServerNetBiosName
, String06 as LogonGuid
, String07 as String07
, String08 as String08
, String09 as KeyLength
, String10 as Process_ID
, String11 as ProcessName
, String12 as LogonProcess
, String13 as AuthPackage
, String14 as String14
, String15 as String15
, String16 as String16
, String17 as String17
, String18 as String18
, String19 as String19
, String20 as String20
, String21 as String21
, String22 as String22

—————————————

, String14 as String14
, String15 as String15
, String16 as String16
, String17 as String17
, String18 as String18
, String19 as String19
, String20 as String20
, String21 as String21
, String22 as String22

=  is default  -> n/a

 

Table join for EventID on Server 2003

SELECT distinct
, li.TargetDomain
, li.PrimaryUser
, li.EventMachine
, li.Source
, li.String09 as AuthPackage
, li.String02 as LogOnFrom
, cast(CAST(li.CreationTime as time) as DATEtime) as LoginDateTime
, dateadd(D,DATEDIFF(D,li.CreationTime, lo.CreationTime), cast(CAST(lo.CreationTime as time) as DATEtime)) as LogoutDateTime
, CAST(li.CreationTime as time) as LoginTime
, li.CreationTime as LoginDate
, lo.CreationTime as LogoutDate
, DATEDIFF(SECOND,li.CreationTime, lo.CreationTime) as diff
,li.String01 as LogonType

FROM
(SELECT * FROM AdtServer.dvAll WHERE EventId = 528) AS li LEFT OUTER JOIN
(SELECT * FROM AdtServer.dvAll WHERE EventId = 538) AS lo ON
li.PrimaryLogonId = lo.ClientLogonId

where
li.String01 in (’10‘,’2′)
and li.CreationTime > dateadd(DAY,-6,GETDATE())
and DATEDIFF(SECOND,li.CreationTime, lo.CreationTime) > 0
and li.PrimaryUser not like ‚%$‘
–and li.PrimaryUser = lo.PrimaryUser
–and li.CreationTime > ‚12.12.2014‘
–and li.String13 not like ‚MICROSOFT_AUTHENTICATION_PACKAGE_V1_0‘
and li.String02 in (‚2′,’10‘)
and li.PrimaryUser not like ‚/_%‘ escape ‚/‘
and li.PrimaryUser = ‚username‘

SCOMMSSQLREPORT

This description of Strings could you little help, if your agent are running on Windows Server 2003 and older:

, String01 as LogonType
, String02 as LogOnFrom
, String03 as String03
, String04 as TargetServerNetBiosName                                                                                                                                                                                                                                                                                                                 , String05 as LogonGuid                                                                                                                                                                                                                                                                                                                                               , String06 as CallerProcessID

, String07 as –
, String08 as LogonProcess
, String09 as AuthPackage

, String10 as String10
, String11 as String11
, String12 as String12
, String13 as String13
, String14 as String14
, String15 as String15
, String16 as String16
, String17 as String17
, String18 as String18
, String19 as String19
, String20 as String20
, String21 as String21
, String22 as String22

Rubriky: System Center | Komentáře nejsou povolené u textu s názvem MS SCOM 2007 R2 – Audit Reports

MS Exchange 2010 v DAG-u je choulostivý na změnu fyzických sektorů při replikaci transakčních logů v režimu „block mode“

images

Jestli máte MS Exchange 2010 server v DAG-u na více mašinách a neprovádíte pravidelné instalace firmware na diskové řadiče serverů, může se vám přihodit jedna nepříjemnost. Známá věc je, že pro možnost mít Mailbox servery v DAG-u je zapotřebí, aby všechny členské servery měli stejné označení pro jména, jednotky disků, kde budou uloženy DB a transakční logy. Také se to ale týká velikosti fyzických sektorů disků. Mimochodem tuto informaci najdete na oficiálním webu Microsoftu –  Exchange storage configuration options V default nastavení budete mít pravděpodobně velikost fyzických sektorů na 512B. V případě, že se vám poškodí řadič, nebo je zapotřebí vyměnit baterku na řadiči disků vám obvykle servisák spolu s komponentou provede i instalaci nejnovějšího firmware a tím vám v některém případě automaticky změní instalací velikost fyzických sektorů.

Obecně s tím nebude problém, protože dnešní operační systémy podporují tzv. Advanced format, odkaz na pěkný článek – advanced-format-prichazeji-pevne-disky-se-4k-sektor

Ovšem v případě, že máte MS Exchange 2010 SP1 a vyšší, replikace transakčních logů vám poběží ve výchozím nastavení v režimu „Block Mode“, tedy používání bufferů na všech Mailbox serverech v DAG-u. MS Exchange vám kontroluje velikost datových bloků a v případě nesouladu velikosti fyzických sektorů na pasivní kopii Db + Transakční log vám přestane zapisovat a aktualizovat data v pasivní kopii DB.  Jak toto vyřešit ? Provést aktualizaci na všech serverech a tedy v některých scénářích provést dost práce, u které se můžete i trochu zapotit :). Protože se může jednat částečně i o virtuální servery, připravil jsem malou ukázku otestování disků VHD a VHDX na již aktualizovaném diskovém řadiči (aktualizace provedla změnu velikosti fyzických sektorů z 512B na 4KB) Server Fujitsu Primergy RX300 S6

Tady to je: )

 

Physical Disks (Server Fujitsu Primergy RX300 S6)

 

PS C:\Users\administrator.VDI> fsutil fsinfo ntfsinfo c:

NTFS Volume Serial Number :       0x4028750a28750068

NTFS Version   :                  3.1

LFS Version    :                  2.0

Number Sectors :                  0x000000003a27e7ff

Total Clusters :                  0x000000000744fcff

Free Clusters  :                  0x0000000006f5df5d

Total Reserved :                  0x0000000000000ff0

Bytes Per Sector  :               512

Bytes Per Physical Sector :       4096

Bytes Per Cluster :               4096

Bytes Per FileRecord Segment    : 1024

Clusters Per FileRecord Segment : 0

Mft Valid Data Length :           0x000000000be00000

Mft Start Lcn  :                  0x00000000000c0000

Mft2 Start Lcn :                  0x0000000000000002

Mft Zone Start :                  0x00000000000cbe00

Mft Zone End   :                  0x00000000000cc820

Resource Manager Identifier :     B2BFCF04-1D79-11E4-9ACC-0019999200EA

 

 

PS C:\Users\administrator.VDI> fsutil fsinfo ntfsinfo f:

NTFS Volume Serial Number :       0x0ea859aba85991d7

NTFS Version   :                  3.1

LFS Version    :                  2.0

Number Sectors :                  0x00000000073f7dff

Total Clusters :                  0x00000000073f7dff

Free Clusters  :                  0x00000000054926b4

Total Reserved :                  0x0000000000020040

Bytes Per Sector  :               4096

Bytes Per Physical Sector :       4096

Bytes Per Cluster :               4096

Bytes Per FileRecord Segment    : 4096

Clusters Per FileRecord Segment : 1

Mft Valid Data Length :           0x0000000000100000

Mft Start Lcn  :                  0x00000000000c0000

Mft2 Start Lcn :                  0x0000000000000002

Mft Zone Start :                  0x00000000000c0100

Mft Zone End   :                  0x00000000000cc820

Resource Manager Identifier :     CBF966D0-1F65-11E4-80B9-0019999CD753

 

 Virtuální disky VHD, VHDX používané v Microsoft OS a Hyper-V  umístěné na fyzických discích viz. výše

 

PS C:\Users\administrator.VDI> #vhd disk H: je ulozen na disku C:

PS C:\Users\administrator.VDI> fsutil fsinfo ntfsinfo h:

NTFS Volume Serial Number :       0xa0da4950da4923be

NTFS Version   :                  3.1

LFS Version    :                  2.0

Number Sectors :                  0x00000000001f27ff

Total Clusters :                  0x000000000003e4ff

Free Clusters  :                  0x000000000003d17f

Total Reserved :                  0x000000000001f2c0

Bytes Per Sector  :               512

Bytes Per Physical Sector :       512

Bytes Per Cluster :               4096

Bytes Per FileRecord Segment    : 1024

Clusters Per FileRecord Segment : 0

Mft Valid Data Length :           0x0000000000040000

Mft Start Lcn  :                  0x0000000000014c55

Mft2 Start Lcn :                  0x0000000000000002

Mft Zone Start :                  0x0000000000014c40

Mft Zone End   :                  0x000000000001c900

Resource Manager Identifier :     2D8AC3C4-372D-11E4-80BA-0019999CD753

 

 

PS C:\Users\administrator.VDI> #vhdx disk I: je ulozen na disku C:

PS C:\Users\administrator.VDI> fsutil fsinfo ntfsinfo I:

NTFS Volume Serial Number :       0x6cce64b8ce647be8

NTFS Version   :                  3.1

LFS Version    :                  2.0

Number Sectors :                  0x00000000001f27ff

Total Clusters :                  0x000000000003e4ff

Free Clusters  :                  0x000000000003d17f

Total Reserved :                  0x000000000001f2c0

Bytes Per Sector  :               512

Bytes Per Physical Sector :       4096

Bytes Per Cluster :               4096

Bytes Per FileRecord Segment    : 1024

Clusters Per FileRecord Segment : 0

Mft Valid Data Length :           0x0000000000040000

Mft Start Lcn  :                  0x0000000000014c55

Mft2 Start Lcn :                  0x0000000000000002

Mft Zone Start :                  0x0000000000014c40

Mft Zone End   :                  0x000000000001c900

Resource Manager Identifier :     2D8AC3D3-372D-11E4-80BA-0019999CD753

PS C:\Users\administrator.VDI>

 

 

PS C:\Users\administrator.VDI> #vhd disk J: je ulozen na disku F:

PS C:\Users\administrator.VDI> fsutil fsinfo ntfsinfo J:

NTFS Volume Serial Number :       0x1a0487290487074b

NTFS Version   :                  3.1

LFS Version    :                  2.0

Number Sectors :                  0x00000000001f27ff

Total Clusters :                  0x000000000003e4ff

Free Clusters  :                  0x000000000003d17f

Total Reserved :                  0x000000000001f2c0

Bytes Per Sector  :               512

Bytes Per Physical Sector :       512

Bytes Per Cluster :               4096

Bytes Per FileRecord Segment    : 1024

Clusters Per FileRecord Segment : 0

Mft Valid Data Length :           0x0000000000040000

Mft Start Lcn  :                  0x0000000000014c55

Mft2 Start Lcn :                  0x0000000000000002

Mft Zone Start :                  0x0000000000014c40

Mft Zone End   :                  0x000000000001c900

Resource Manager Identifier :     2D8AC3ED-372D-11E4-80BA-0019999CD753

 

 

PS C:\Users\administrator.VDI> #vhdx disk k: je ulozen na disku F:

PS C:\Users\administrator.VDI> fsutil fsinfo ntfsinfo k:

NTFS Volume Serial Number :       0x6c8ca2ec8ca2b04e

NTFS Version   :                  3.1

LFS Version    :                  2.0

Number Sectors :                  0x00000000001f27ff

Total Clusters :                  0x000000000003e4ff

Free Clusters  :                  0x000000000003d17f

Total Reserved :                  0x000000000001f2c0

Bytes Per Sector  :               512

Bytes Per Physical Sector :       4096

Bytes Per Cluster :               4096

Bytes Per FileRecord Segment    : 1024

Clusters Per FileRecord Segment : 0

Mft Valid Data Length :           0x0000000000040000

Mft Start Lcn  :                  0x0000000000014c55

Mft2 Start Lcn :                  0x0000000000000002

Mft Zone Start :                  0x0000000000014c40

Mft Zone End   :                  0x000000000001c900

Resource Manager Identifier :     2D8AC3FD-372D-11E4-80BA-0019999CD753

Rubriky: Exchange Server / Exchange Online, MIcrosoft Windows (client/server) | Komentáře nejsou povolené u textu s názvem MS Exchange 2010 v DAG-u je choulostivý na změnu fyzických sektorů při replikaci transakčních logů v režimu „block mode“

How change MS SQL Collation, JAK změnit MS SQL Collation

SQL_Server

Jednou jsem takhle prováděl nějaké testování vypečené aplikace a když se mi ji nedařilo nainstalovat, zjistil jsem, že mám v MS SQL nastaveno špatně Collation (ve zkratce. – používá se pro  řazení znaků v MS SQL). No nejsem MS SQL guru a tak jsem upřímně poprvé na něco takového narazil.  V minulosti se prostě nevyskytla chybka ohledně této konkrétní věci a tak nebylo třeba se  ji zabývat. Jenže co když už máte MS SQL server nainstalovaný a nakonfigurovaný ?  Server se dá reinstalovat, což jsem stejně nakonec udělal :), protože jsem si vybral i špatnou verzi MS SQL,  ale Collation se dá změnit i bez reinstalace MS SQL.

Protože jsem dnes opět instaloval MS SQL server pro otestování app a opět jsem narazil na špatný výběr Collation v MS SQL serveru, rozhodl jsem se podělit se a vložit na tyto stránky postup,  jak lze Collation rychle změnit. Zde je prověřený postup.

 

1. Zastavte všechny MS SQL služby / (stop all MS SQL services )

2. V příkazové řádce cmd.exe pod administrátorem spusťte následující příkaz (verzi Collation je na vás, já přikládám tu , kterou jsem potřeboval) / (in cmd.exe run command let below)

Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=<InstanceName>
/SQLSYSADMINACCOUNTS=<AdminAccount> /[SAPWD=<Password>
/SQLCOLLATION=Latin1_General_CI_AS

3. Spusťte všechny MS SQL služby / ( start all MS SQL services)

 

MSSQLCollation

Rubriky: Others | Komentáře nejsou povolené u textu s názvem How change MS SQL Collation, JAK změnit MS SQL Collation

Zobrazení velikosti diskových sektorů ve Windows

Toto je způsob jak si ve Windows můžete nechat zobrazit velikost diskových sektorů. Funguje v cmd.exe nebo v powershellu

#wmic

#wmic:root\cli>diskdrive

nebo

#fsutil fsinfo ntfsinfo c:

disk

 

Understanding the Impact of Large Sector Media for IT Pros

http://technet.microsoft.com/en-us/library/hh147334(v=ws.10).aspx

 

Rubriky: MIcrosoft Windows (client/server) | Komentáře nejsou povolené u textu s názvem Zobrazení velikosti diskových sektorů ve Windows