Skip to main content

MCSA 740

Basic Powershell remote and install feature

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

Powershell Desired state configuration

### USE THIS FOR DESIRED STATE CONFIGURATION ###
### (separate code below for LCM configuration) ###

# create a DSC configuration to install IIS and support remote management
Configuration IISConfig {

    # define input parameter
    param(
        [string[]]$ComputerName = 'localhost'
    )

    # target machine(s) based on input param
    node $ComputerName {

        # install the IIS server role
        WindowsFeature IIS {
            Ensure = "Present"
            Name = "Web-Server"
        }

        # install the IIS remote management service
        WindowsFeature IISManagement {
            Name = 'Web-Mgmt-Service'
            Ensure = 'Present'
            DependsOn = @('[WindowsFeature]IIS')
        }

        # enable IIS remote management
        Registry RemoteManagement {
            Key = 'HKLM:\SOFTWARE\Microsoft\WebManagement\Server'
            ValueName = 'EnableRemoteManagement'
            ValueType = 'Dword'
            ValueData = '1'
            DependsOn = @('[WindowsFeature]IIS','[WindowsFeature]IISManagement')
        }

        # configure remote management service
        Service WMSVC {
            Name = 'WMSVC'
            StartupType = 'Automatic'
            State = 'Running'
            DependsOn = '[Registry]RemoteManagement'
        }

    }

}

# create the configuration (.mof)
IISConfig -ComputerName WEB-NUG -OutputPath c:\nuggetlab

#************Attention!************
# As you follow along in the video at 14:20 please pause and run the script below

# push the LCM configuration to WEB-NUG
Set-DscLocalConfigurationManager -Path "C:\Nuggetlab" -ComputerName WEB-NUG -Verbose

#this step is necessary to set the "ApplyAndAutoCorrect" mode.

# push the configuration to WEB-NUG
Start-DscConfiguration -Path c:\nuggetlab -Wait -Verbose


# enter powershell remote session
Enter-PSSession -ComputerName WEB-NUG

# view installed features
Get-WindowsFeature | Where-Object Installed -eq True

# view LCM properties
Get-DscLocalConfigurationManager

# view configuration state
Get-DscConfigurationStatus

# test configuration drift
Test-DscConfiguration

# exit powershell remote session
Exit-PSSession


### USE THIS FOR LOCAL CONFIGURATION MANAGER ###
[DscLocalConfigurationManager()]

Configuration LCM {
    node WEB-NUG {
        settings {
            ConfigurationMode = "ApplyAndAutoCorrect"
            ConfigurationModeFrequencyMins = 15
            RefreshMode = "Push"
        }
    }
}

# create the configuration (.mof)
LCM -OutputPath C:\Nuggetlab

# push the LCM configuration to WEB-NUG
Set-DscLocalConfigurationManager -Path "C:\Nuggetlab" -ComputerName WEB-NUG -Verbose

Windows Activation

Multiple Activation Keys - Max 50 machines

KMS Key Management Service - Over 50 devices (over 25 clients or 5 servers)

Active Directory-Based Activation - Uses Active directory (min Windows 8/2012)

Automatic Virtual Machine Activation

Regular Keys - install

slmgr /ipk <KEY>
slmgr /ato

License Conversion 

DISM /online /Set-Edition:ServerStandardCor /ProductKey:AVMAKEY /AcceptEula

slmgr /div - check on activation

----------NTFS Permissions--------------

Effective Access - Check permissions per user for a share or folder

----------------Advanced Storage----------------------------

image-1582073777557.png

image-1582077076177.png

image-1582078867786.png

image-1582084509982.png

image-1582088804841.png