DSCResources/DSC_HostsFile/en-US/about_HostsFile.help.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.NAME
    HostsFile
 
.DESCRIPTION
    This resource is used to control entries on a the host file for a node.
 
.PARAMETER HostName
    Key - String
    Specifies the name of the computer that will be mapped to an IP address.
 
.PARAMETER IPAddress
    Write - String
    Specifies the IP Address that should be mapped to the host name.
 
.PARAMETER Ensure
    Write - String
    Allowed values: Present, Absent
    Specifies if the hosts file entry should be created or deleted.
 
.EXAMPLE 1
 
Add a new host to the host file.
 
Configuration HostsFile_AddEntry_Config
{
    Import-DSCResource -ModuleName NetworkingDsc
 
    Node localhost
    {
        HostsFile HostsFileAddEntry
        {
            HostName = 'Host01'
            IPAddress = '192.168.0.1'
            Ensure = 'Present'
        }
    }
}
 
.EXAMPLE 2
 
Remove a host from the hosts file.
 
Configuration HostsFile_RemoveEntry_Config
{
    Import-DSCResource -ModuleName NetworkingDsc
 
    Node localhost
    {
        HostsFile HostsFileRemoveEntry
        {
            HostName = 'Host01'
            IPAddress = '192.168.0.1'
            Ensure = 'Absent'
        }
    }
}