This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Get Net Adapter Names | |
$NetAdapterName = (Get-NetAdapter).Name | |
#Create the External Hyper-V Switch | |
New-VMSwitch -NetAdapterName $NetAdapterName[0] -Name 'External' | |
#Create the Internal Hyper-V Switch | |
New-VMSwitch -SwitchType Internal -Name 'Internal' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-DSCPullArchive | |
{ | |
<# | |
.Synopsis | |
Converts PowerShell Modules to compressed .zip files. | |
.DESCRIPTION | |
Converts PowerShell Modules to compressed .zip files | |
used by Desired State Configuraiton pull servers. | |
.PARAMETER Source | |
Specifies the source location of a PowerShell module. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$source = "C:\LabResources\xTimeZone" | |
$destination = "C:\temp" | |
$Version = (Get-ChildItem -Path $source -Depth 1).Name | |
$ResoureName = (Get-ChildItem -Path $source -Depth 1).Parent.Name | |
$ModuleName = $ResoureName+'_'+$Version | |
New-Item -Path ($destination+'\'+$ModuleName) -ItemType Directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Find External DHCP enabled interface | |
$External = (Get-NetIPAddress -AddressFamily IPv4).Where{$_.PrefixOrigin -eq 'Dhcp'} | |
#Rename DHCP adpter to External | |
Rename-NetAdapter -Name $External.InterfaceAlias -NewName 'External' | |
#Find Internal adpater | |
$Internal = (Get-NetIPAddress -AddressFamily IPv4).Where{$_.PrefixOrigin -ne 'Dhcp' -and $_.InterfaceAlias -notmatch 'Loopback'} | |
Rename-NetAdapter -Name $Internal.InterfaceAlias -NewName 'Internal' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Move-ADGroupMemberofToMember { | |
<# | |
.SYNOPSIS | |
Moves all Member Of objects to the Members section of an Active Directory group. | |
.DESCRIPTION | |
Queries an Active Directory group for all Member Of groups then add them to the members section | |
and removes them from the member of section of the active directory group. | |
.PARAMETER TargetGroup | |
Specify the group to run the cmdlet against. | |
.EXAMPLE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Move-ADGroupMemberofToMember { | |
<# | |
.SYNOPSIS | |
Moves all Member Of Groups to the Members section of an Active Directory group. | |
.DESCRIPTION | |
Queries an Active Directory group for all Member Of groups then add them to the members section | |
and removes them from the member of section of the active directory group. | |
.PARAMETER Identity | |
Specify the group to run the cmdlet against. | |
.EXAMPLE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$parms = @{ | |
'class'='Win32_LogicalDisk'; | |
'computername'='DESKTOP'; | |
'filter'='drivetype=3'; | |
} | |
Get-WmiObject @parms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Disable-ADComputer { | |
<# | |
.SYNOPSIS | |
Disables Computers and moves them to the specified OU. | |
.DESCRIPTION | |
Take string or object input for computers then disables each one and moves to the specified ou | |
then outputs errors to a log file. | |
.PARAMETER Identity | |
Name of computer or computers | |
.PARAMETER DisabledOU |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Copy-SQLTable { | |
<# | |
.SYNOPSIS | |
Copies a table from a source database and inserts it into the target database. | |
.DESCRIPTION | |
Takes all the data from the source database and inserts it into the target database with the same name. | |
.PARAMETER TableName | |
Specifies the table name to be copied from the source and inserted into the target. | |
.PARAMETER SourceServer | |
Specifies source server DNS name and instance, use ServerName\InstanceName. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configuration SMTP { | |
Node HTTPComputers { | |
WindowsFeature SMTP{ | |
Name = 'SMTP-Server' | |
Ensure = 'Present' | |
} | |
} | |
} |