четверг, 2 мая 2019 г.

How to launch Active Directory Users and Computers for a different domain/forest

If you are working with multiple domains that are not connected through full trust and need to run Active Directory Users and Computers or another MMC console file with credentials from a different domain, here is a solution for you.

To create a batch file, enter the following lines into a text editor:
runas /netonly /user:Domain\User "mmc dsa.msc /server=10.10.10.10"
runas /netonly /user:Domain\User "mmc dsa.msc /server=Domain.local"

Replace "Domain/User" and "IP" in the batch file with the appropriate values for your environment.

Please note that you will need to run the batch file as an administrator, although there is a way to avoid this which I will explain shortly. When you run the batch file, it will prompt you to enter your password in the Command Prompt window.


If you frequently use the batch file, you can use the following trick to avoid having to run it as an administrator every time:
  1. Create a shortcut to the batch file.
  2. Right-click on the shortcut and select "Properties".
  3. Click on the "Advanced" button.
  4. Check the box next to "Run as administrator".
  5. Click "OK" to save the changes.
Now, when you double-click the shortcut, the batch file will automatically run as an administrator without requiring you to right-click and select "Run as administrator" every time.



This trick will save you the extra step of having to right-click and select "Run as administrator" each time you run the batch file.

Unfortunately, it is not possible to use the same trick with the GPMC.msc console. This program must be run in the context of the needed domain, for example, from the domain's DC.


пятница, 22 марта 2019 г.

Snapshots или снапшоты

Сегодня мы рассмотрим одну из интереснейших функций – снэпшоты.
Эта тема немного мистическая и при первом знакомстве снапшоты могут ошеломить.
И это понятно, ведь у них есть 2 удивительных свойства: они мгновенно работают и почти не занимают места.
Возникает вопрос - как это возможно?
И могут ли они заменить нормальный бэкап?

Ответ на последний вопрос прост - нет, не могут. Снапшот не заменяет бэкап полностью - у него другие цели, задачи и средства их решения. И, прежде всего, снапшоты находятся на том же диске, что и исходные данные. Иными словами, они не защищают от отказа/поломки диска, на котором находятся данные (hardware problems). Зато от всего остального они защищают отлично: это и человеческие ошибки, и проблемы с программами и файловой системой и т.д. Они могут служить машиной времени, которая почти мгновенно и без усилий может перемещать вас во времени в любых направлениях...

Современные программы бэкапа вовсю используют снапшоты для своих задач.
Вспомним главные недостатки classical backup - он медленный и занимает много места. Поскольку он медленный он может не быть консистентным. Файлы могут измениться за время бэкапа, а некоторые (о ужас) могут вообще не войти в бэкап. Представьте себе, что в процессе вы забэкапили одну папку, а через час другую. Но в промежутке между этими моментами вы переписали файл из 2-й папки в 1-ю. Вначале это файл еще не был в первой папке, а в конце он уже не находился во второй – такой файл на попадет в бэкап. Надеюсь, понятно, почему?
Снэпшот, за счет своей скорости, спасает бэкап от всех этих проблем. Т.е., бэкап и снэпшот сегодня работают рука об руку.

И, все же, вернемся к первому вопросу - как снэпшот работает и почему он такой быстрый и маленький. То есть, в чем его отличие от нормального бэкапа?

Попробуем сравнить снэпшот с книгой.
В книгах есть 2 вещи - основной текст и оглавление/содержание, которое нужно для быстрого нахождения нужного текста.
Представим себе, что писатель решил зафиксировать текущее состояние книги, которую он пишет. Для этого он должен создать дополнительное оглавление. Также, применить правило – вырывание страниц (указанных в дополнительном оглавлении) строго запрещено. Теперь, каждый раз, когда писатель будет добавлять новые страницы, он будет динамически обновлять оглавление, но не сохранять. При этом оглавление-снэпшот будет сохраняться все время. Будут сохраняться и страницы, на которые оглавление указывает.

В результате станут существовать 3 типа страниц:
- неизмененные страницы останутся на своих местах (на них будут указывать как текущее, так и дополнительное оглавление-снэпшот),
- новая информация будет записана на чистых страницах,
- измененные страницы будут записаны на чистых страницах.
Кроме того, останутся чистые/незаполненные страницы.
Теперь, чтобы вернуться на старый вариант книги, достаточно заменить оглавление на старое и оно укажет на старые страницы.

Аналогично и с реальным снэпшотом.
В момент создания снэпшот построится дополнительная таблица файлов (MFT для NTFS). Также создастся правило – удаление файлов/блоков, указанных в MFT, запрещено.
После этого момента на диске будут существовать 3 типа данных:
- неизмененные блоки останутся на своих местах (на них указывает текущий MFT и MFT снэпшота),
- новая информация будет записываться на новое место,
- измененные данные будут записываться на новое место.
Кроме того, останется пустое пространство на диске.
Теперь, чтобы вернуться обратно во времени, надо всего лишь заменить таблицу файлов (file table) на старую и она укажет на старое содержимое диска. И это очень быстрая операция.

Повторим еще раз.
Снэпшот не копирует сами данные в другое место, как бэкап. Вместо этого он создаёт дополнительное оглавление (например, MFT для NTFS). Оглавление указывает на расположение файлов. Эти файлы никогда не затираются новыми, а все новые файлы записываются в другие места.

У нас был один подвопрос - почему снэпшот не занимает много места? Ответ - все по той же причине – место занимает лишь новая файловая таблица.

Остался еще один интересный вопрос, который мы проскочили вскользь - что происходит с файлами, которые мы изменяем, куда попадают измененные блоки? На самом деле мы пока поговорили только об одном из существующих вариантов.

Оказывается, некоторые системы пишут изменённые блоки в новые места (NetApp),
некоторые в старые, предварительно скопировав старые блоки в новые места (copy on write - EMC), а некоторые (VMware) создают новые файлы, в которые записываются все изменения.

Эти способы различаются скоростью записи данных, а также скоростью удаления снэпшотов. Например, создание нового файла, как VMware, не представляет проблемы и происходит быстро. Но удаление такого файла не так эффективно и занимает ощутимое время. И в таких системах, как VMware, не рекомендуется создавать много снэпшотов, а также хранить их длительное время.

Но наше время уже подходит к концу и на этом мы пока закончим.

суббота, 16 марта 2019 г.

20 questions and answers from firefighting organization

STORAGE
1.      Where you define Zones for Storage?
On optical Switches.
2.      What is the main difference between SAN and NAS and what type would you put in this organization?
SAN (Storage Area Network) = block protocol = local storage, must for SQL DB, Exchange Server, etc.
Uses FC, FCoE, iSCSI protocols.
NAS (Network Attached Storage) = ethernet file storage protocol (SMB/NFS) = file server.
SQL
1.      What are MDF and LDF files in SQL?
MDF - Master Database Files
LDF - Log Database Files
2.      What is the difference between DB DETACH and Take Offline?
DETACH removes the registration of the database and deletes DB metadata from SQL server.
DETACH can change the file ACLs so that the detacher has control of them.
Take Offline retains database metadata in SQL server sys.databases system table.
3.      How is it possible to move DB between different SQL servers?
Detach – Move – Attach (MDF/LDF)
Backup – Move – Restore (BAK)
4.      What is the name of SQL Server query language?
T-SQL (Transact-SQL)
WINDOWS SERVER
1.      Is Recycle Bin enabled on DC by default? NO!
2008 R2 - you have to enable the AD Recycle Bin manually by running PowerShell commands.
2012 - you have to enable the AD Recycle Bin manually by running PowerShell commands. You’ve get GUI.
2.      There are 10 defined policies on a specific OU. On the 10th policy defined DENY on the same definition as on the 1st policy. Which policy will actually work?
The last.
3.      What is DNS Scavenging?
Feature that allows you to automate the deletion (scavenge) of outdated DNS resource records. 
4.      How to force replication between DC servers?
Active Directory Sites and Services or Repadmin /syncall.
5.      What is ICMP, what is it for, and on which port it works?
ICMP (Internet Control Message Protocol) - error-reporting protocol, there is no TCP/UDP port number. 
6.      What port uses SSH? 22
7.      IIS – you tried to access some internet page and got error 500? What is it?
Internal Server Error 500 is a very general HTTP status code that means something has gone wrong on the web site's server.
VMWARE
1.      What is DRS?
DRS (Distributed Resource Scheduler) – balances the load on the cluster in automated way.
2.      You’ve created VM – what is the first thing to do after booting it and installing OS?
To eject DVD and install VMTools.
3.      In your organization allowed to use only ISO images for transferring data to VMs.
How can you insert ISO to VM?

By using virtual DVD in the VM properties.
4.      You need to check a real-time performance on ESX.
For that you should approach this ESX with SSH. What you need to do?

First you need to enable SSH from ESX or from vCenter and then approach ESX with Putty.
SCENARIOS
1.      User is moving files to the network folder that is synchronized with his profile. One day the sync is interrupted. How would you get to the trouble?
Check that file names are not over 260 characters including the file path.
Check beginning and trailing characters.
Log on to another computer and check sync. Log on to the current computer with different user and check.
Recreate the profile.
2.      There is VM with IIS server. Part of users can access the site and part is not. What would you check?
VLANs and subnets.
CLOUD
1.      Would you recommend moving to CLOUD for organization such as ours? If yes in which layout?
Yes, but only partly as the first step. The first thing I would insert is Office 365.


воскресенье, 10 марта 2019 г.

Как добавить в группу пользователей OU

To obtain the LDAP path for OU and GROUP objects in ADUC Attribute Editor, follow these steps:

  1. Open the Attribute Editor for the object you are interested in.
  2. Locate the "distinguishedName" attribute and click on it.
  3. Copy the LDAP path for the OU or GROUP object.


###############
$OUpath = "OU=Administrators,DC=Domain,DC=Local"
$GROUPpath = "CN=vCenter_Admins,OU=Administrators,DC=Domain,DC=Local"

$OUusers = Get-ADUser -Filter * -SearchBase $OUpath
$GROUP = Get-ADGroup -Identity $GROUPpath

Add-ADGroupMember -Identity $group -Members $users
###############

понедельник, 25 февраля 2019 г.

How to check Uptime of Windows computer

1. The most simple way is to enter to Task Manager (Ctrl-Shift-Esc), then go to tab Performance.
You will see a number of days and hours.

2. There is a slightly more difficult way.

 Add CPU Time column.

 Order CPU Time column in descending order and you will see the time in hours.

3. And in the end the best way to lovers of the command line.
Firstly type date command to know what is the day today.
Then type NET STATISTICS SERVER.

пятница, 22 февраля 2019 г.

Prefer IPv4 over IPv6

The easiest and the difficulties solution because you need to know which value to change.
The second line is for demo purposes only.

netsh interface ipv6 show prefixpolicies
netsh interface ipv6 add prefixpolicy 2001:470::/32 3 6

PowerShell method:
Get-ItemProperty -Path hklm:SYSTEM\CurrentControlSet\Services\tcpip6\Parameters -Name "DisabledComponents" | select -exp DisabledComponents Set-Itemproperty -Path hklm:SYSTEM\CurrentControlSet\Services\tcpip6\Parameters -Name "DisabledComponents" -value 32 –

This is a more generic solution which is less compliant and supported but always works.

  • Open RegEdit.
  • Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip6\Parameters
  • Create DisabledComponents DWORD (32-bit value) registry value, set its value to 20 (Hexadecimal).
  • Reboot.
For fully disable IPv6 set the value to ffffffff (Hexadecimal).

בעיית שרת BACKUP ופתרונה.

בערב יום רבעי בתאריך 20.05.2009 שרת BACKUP הפסיק לעבוד.

לשרת הנ"ל היו כמה בעיות:
1. בעיית חומרה
2. בעיית תוכנה ומערכת הפעלה

תיפול בבעיית חומרה נעשה ביום שישי (22.05.2009) והיה קשור בתפקוד RAID וכונני SCSI,
שבירת MIRROR, זיהוי תקלה פיזית באחד מהדיסקים, הוצאתו מעבודה ובניית RAID מדיסק אחד
כולל פורמט של דיסק אשר לקח הרבה זמן והסתיים כעבור זמן רב.

במהלך תיפול בבעיות מערכת הפעלה וחיפושים באינטרנט התברר שאפשר לגרום לשרת לעלות רק בעזרת שיחזורRegistry הישן.
האחרון הייה מתאריך 06.2003.
אחר השחזור התברר שהדבר לא מאפשר התקנה של תוכנת גיבוי BackupExec בגלל התנגשויות עםRegistry הישן.

עלה הרעיון להתקין מערכת הפעלה מחדש (from the scratch).
הניסיון להתקין SERVER 2000 לא הצליח (לא זיהה דיסקים ו-RAID).
הניסיון להתקין SERVER 2003גם לא הצליח. ההתקנה לא עברה 27% בהעתקת קבצים (בגלל תקלה בדיסק ?).
התברר שאפשר להתקין SERVER 2000 בעזרת CD "Dell OpenManage Server Assistant" אשר מכין שרת להתקנה ונותן דרייברים,
אבל הייה חשוב לתקן קודם בעיית RAID הלא תקין. הבעיה הייתה שלשרת היו 20Gb חומר והשרת הייה מושבת בעקבות התקנות הלא מוצלחות !
עלתה השאלה – מה לעשות !?
הפתרון נימצא לאחר חיפושים רבים בעזרת CD הגאוני בשם "ERD Commander 2005" של Winternals. שער הכלים לא זיהו או RAID-SCSI או את ה-Network.
בערב של 21.05.2009 נעשתה העברה מוצלחת של החומר לשרת SQL2005AB.
לאחר מכן נפתרה בעיית חומרה (בתאריך 22.05.2009) וביום הראשון (בתאריך 24.05.2009) הותקנו SERVER 2000כולל דרייבר של Tape Backup (חיפוש באינטרנט)
ותוכנת הגיבוי BackupExec.

הדבר האחרון לבצעה – לבנות JOB-ים של הגיבוי.

בברכה, ולדי