idebski
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Projekt - Zarządzanie systemi Windows / Zarządzanie usługami w systemie Windows ### Michał Grajzer, Iwo Dębski. CDV 2020. ## Spis treści 1. [Opis Projektu](#Opis-Projektu) 2. [Specyfikacja techniczna sieci oraz stacji roboczych](#Specyfikacja) 3. [Instalacja Active Directory na środowisku Windows Server 2016 (DataCenter)](#Instalacja-Active-Directory-na-%C5%9Brodowisku-Windows-Server-2016-DataCenter) 4. [Konfiguracja WSUS](#Konfiguracja-WSUS) 5. [Połączenie z Active Directory](#Połączenie-z-Active-Directory) 6. [Skrypty](#Skrypty-u%C5%82atwiaj%C4%85ce-prace) ## Opis projektu Propozycja wyposażenia uczelni CDV z uwzględnieniem wyposażenia zarówno serwerownii jak i sal komputerowych. Dla tego projektu przyjęto uwzględnienie jednej w pełmni wyposażonej serwerowni oraz osiem sal komputerowych posiadających 41 stanowisk pracy. Projekt w całości został przygotowany przez Michała Grajzera oraz Iwo Dębskiego w ramach zaliczenia przedmiotów Zarządzanie Systemami Windows oraz Zarządzanie Usługami w Systemach Windows w semestrze letnim 2020. ## Specyfikacja techniczna sieci oraz stacji roboczych #### Serwerownia: 2 x Szafa rack NetShelter SX 42U (model: AR3100) - 26316,46zł 3 x Listwa zasilająca 230V Base Link - 245,98zł 9 x Przełącznik DELL 48P (model: N3048P52102091) - 130491,00zł 4 x Serwer rack Dell PowerEdge R540 - 38396zł #### Pracownie komputerowe: 328 x monitor Dell UP3218K - 4654648,20zł 328 x komputer Dell Precision 3431 SFF - 4113448,00zł #### ŁĄCZNY KOSZT: 8963545,64zł ## Instalacja Active Directory na środowisku Windows Server 2016 (DataCenter) 1. Zaloguj się jako **administrator** do stworzonego wcześniej serwera 2. W Server Manager wybierz opcje **'Add roles and features'** ![](https://i.imgur.com/xUbFj64.png) 3. W pierwszym oknie wybierz **'Next'** ![](https://i.imgur.com/2nToqfh.png) 4. Wybierz opcję **'Role-based'** ![](https://i.imgur.com/Ge9PL18.png) 6. Wybierz server ![](https://i.imgur.com/2vbQK10.png) 7. Wybierz opcje **'Active Directory Domain Services'** i kliknij **'Add Features'** ![](https://i.imgur.com/BTq4cLt.png) 8. Wybierz wszystkie niezbędne dodatki ![](https://i.imgur.com/z4NBdFm.png) 9. Kliknij **'Next'** w oknie AD DS 10. Potwierdź instalacje klikając **'Install'** 11. Instalacja kończy się informacją **'Configuration required'** ![](https://i.imgur.com/wblc3Rj.png) 12. Aby móc korzystać z AD należy go skonfigurować. Kliknij na ikonę flagi(zaświeci się obok niej wykrzynik) oraz wybierz **'Promote this server to a domain controller'** w Server Manager. 13. W oknie konfiguracyjnym wybierz **'Add a new forest'** oraz podaj root domain name. ![](https://i.imgur.com/JeJgYM0.png) 14. Podaj hasło DSRM. ![](https://i.imgur.com/VseNKIY.png) 15. Kliknij **'Next'** w oknie 'DNS options' 16. Zweryfikuj netBIOS domain name ![](https://i.imgur.com/8RuVCvL.png) 17. Podaj ścieżki do bazy danych, logów oraz sysvol (na obrazku defaultowe) ![](https://i.imgur.com/jRj2Qhg.png) 18. W następnym kroku można pobrać skrypt PS do automatycznej konfiguracji AD. Klikamy **'Next'**. 19. Po sprawdzeniu wymagań klikamy **'Install'**. Po konfiguracji serwer zrestartuje się automatycznie. ![](https://i.imgur.com/3qpxZhN.png) ## Konfiguracja WSUS 1. Instalacja WSUS'a wygląda analogicznie jak przy instalacji AD (pkt.1-10). 2. W Menu Start wyszukujemy narzędzie WSUS. ![](https://i.imgur.com/JrtGe8c.png) 3. Uruchamia się kreator konfiguracji. Klikamy "Next". ![](https://i.imgur.com/reUdfmW.png) 4. Wybieram źródło pobieranych aktualizacji. W tym konkretnym przypadku jest to serwer MS. Klikamy "Next". ![](https://i.imgur.com/J4HQ0GG.png) 5. Jeżeli tego wymaga konfiguracja możemy skonfigurować serwer proxy. Pomijamy, klikając "Next". ![](https://i.imgur.com/lOdc6BT.png) 6. Weryfikujemy konfigurację. Klikamy "Start Connecting", czekamy na wykonanie się operacji, następnie klikamy "Next". ![](https://i.imgur.com/AkEb5xk.png) ![](https://i.imgur.com/8uy5LvX.png) ![](https://i.imgur.com/VStEDNh.png) 7. Wybieramy, dla których systemów operacyjnych mają być pobierane i dystrybuowane aktualizacje. W naszym przykładzie jest to nasza wersja Windows Server oraz Windows 10 Professional. Następnie klikamy "Next". ![](https://i.imgur.com/EaRfifk.png) 8. Wybieramy typ aktualizacji, który ma być pobierany i dystrybuowany. Klikamy "Next". ![](https://i.imgur.com/bDPzuQa.png) 9. Ustawiamy sposób synchronizacji z serwerami aktualizacji MS. Klikamy "Next". ![](https://i.imgur.com/uvnOcpY.png) 10. Kończymy konfigurację klikając "Finish". ![](https://i.imgur.com/FRSfmG1.png) 11. Po uruchomieniu WSUS widać ekran z aktualnymi statystykami. ![](https://i.imgur.com/Zx3AiFd.png) ## Połączenie z Active Directory Aby dodać użytkownika należy skonfigurować DNS oraz dodać użytkownika do lokalnego dostępu z RDP (jeśli używamy VM). Po zalogowaniu jako user z AD możemy zobaczyć, że polityki zostały zaktualizowane: ![](https://i.imgur.com/wcWPr1B.png) ## Skrypty ułatwiające prace 1. Sprawdzanie ilości wolnego miejsca na wszystkich dyskach (**VBScript**): ``` Const HARD_DISK = 3 strComputer = "." outFile="C:\logs\freespace" & Right("0" & Month(Now), 2) & "-" & Right("0" & Day(Now), 2) & "-" & Year(Now) & ".log" Set objFSO=CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile(outFile,True) Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colDisks = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk WHERE DriveType = " & HARD_DISK & "") For Each objDisk in colDisks objFile.Write "Device ID: " & objDisk.DeviceID & " Free Disk Space: " & (objDisk.FreeSpace / 1024 / 1024 / 1024 ) & " GB" Next objFile.Close ``` 2. Usuwanie plików z folderu 'Download' starszych niż 5 dni (**VBScript**): ``` Set oFileSys = WScript.CreateObject("Scripting.FileSystemObject") sRoot = "C:\Downloads" today = Date nMaxFileAge = 5 DeleteFiles(sRoot) Function DeleteFiles(ByVal sFolder) Set oFolder = oFileSys.GetFolder(sFolder) Set aFiles = oFolder.Files Set aSubFolders = oFolder.SubFolders For Each file in aFiles dFileCreated = FormatDateTime(file.DateCreated, "2") If DateDiff("d", dFileCreated, today) > nMaxFileAge Then file.Delete(True) End If Next For Each folder in aSubFolders DeleteFiles(folder.Path) Next End Function ``` 3. Sprawdzanie jak długo server/komputer stoi (**PowerShell**) ``` $ComputerName = $env:COMPUTERNAME $userSystem = Get-WmiObject win32_operatingsystem -ComputerName $ComputerName -ErrorAction SilentlyContinue if ($userSystem.LastBootUpTime) { $sysuptime= (Get-Date) - $userSystem.ConvertToDateTime($userSystem.LastBootUpTime) Write-Output ("Last boot: " + $userSystem.ConvertToDateTime($userSystem.LastBootUpTime) ) Write-Output ("Uptime : " + $sysuptime.Days + " Days " + $sysuptime.Hours + " Hours " + $sysuptime.Minutes + " Minutes" ) } else { Write-Warning "Unable to connect to $computername" } ``` 4. Export użytkowników AD do csv (**Powershell**): ``` Import-Module ActiveDirectory $d = Get-Date -Format "ddMMyyyy" Get-ADUser -Filter * -Properties * | export-csv "c:\list-of-users_$d.csv" ``` 5. Blokowanie użytkowników AD nieaktywnych od 180 dni (**PowerShell**): ``` Import-Module ActiveDirectory $timespan = New-Timespan -Days 180 Search-ADAccount -UsersOnly -AccountInactive -TimeSpan $timespan | Disable-ADAccount ``` 6. Dodawanie użytkowników z csv (**PowerShell**): ``` Import-Module ActiveDirectory $Users = Import-Csv -Delimiter "," -Path "C:\UsersToAdd-test.csv" foreach ($User in $Users) { $Displayname = $User.Firstname + " " + $User.Lastname $UserFirstname = $User.Firstname $UserLastname = $User.Lastname $OU = "$User.OU" $SAM = $User.SAM $UPN = $User.Firstname + "." + $User.Lastname + "@" + $User.Maildomain $Description = $User.Description $Password = $User.Password New-ADUser -Name "$Displayname" -DisplayName "$Displayname" -SamAccountName $SAM -UserPrincipalName $UPN -GivenName "$UserFirstname" -Surname "$UserLastname" -Description "$Description" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path "$OU" -ChangePasswordAtLogon $false –PasswordNeverExpires $true -server domain.loc } ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully