Skip to content

Instantly share code, notes, and snippets.

View gabrielrojasnyc's full-sized avatar

Gabriel Rojas gabrielrojasnyc

View GitHub Profile
get-help "command name"
get-member "command name | get-member"
help
get-Windows Feature -name AD*
@gabrielrojasnyc
gabrielrojasnyc / gist:c3f4ab1a8a3f9ce308c5
Created November 29, 2015 22:35
install AD feature
get-WindowsFeature AD-Domain-Services | Install-WindowsFeature
@gabrielrojasnyc
gabrielrojasnyc / gist:0f3384adf458c3884181
Created November 29, 2015 22:42
Find command in modules
Get-Command -Module ADDS*
GEt-Help *adds*
get-help Install-ADDSForest -Examples
Install-ADDSForest -DomainName 'company.local' -InstallDNS
@gabrielrojasnyc
gabrielrojasnyc / AvailableIP1
Last active December 11, 2015 03:38
Find Available IP on the Vlan and display output on the screen
1..254 | ForEach-Object {
if(!(Test-Connection 10.0.100.$_ -count 1 -Quiet)) {
Write-Output "IP Address Available 10.0.100.$_"
}
else {
Write-Output "IP Address in use 10.0.100.$_"
}
}
@gabrielrojasnyc
gabrielrojasnyc / IPAddress2
Last active December 11, 2015 03:49
Fins IP address available and output to an object
$Vlan = 1..3 | ForEach-Object {
if(!(Test-Connection 10.0.100.$_ -count 1 -Quiet)) {
[pscustomobject]@{Name = "Available"; Value = "10.0.100.$_"}
}
else {
[pscustomobject]@{Name = "Not Available"; Value = "10.0.100.$_"}
}
}
@gabrielrojasnyc
gabrielrojasnyc / gist:4e3b0a6b99953f5f94c0
Created December 28, 2015 19:09
Get-LocalNIC.test.ps1
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"
Describe "Get-LocalNIC" {
It "makes sure there is a NIC with the Wi-Fi name present" {
Get-LocalNICName | Should Be 'Wi-Fi'
}
It "returns the MTU size = 1500" {
function Get-LocalNICName {
(Get-NetAdapter | Where-Object { $_.Name -eq 'Wi-Fi'}).Name
}
function Get-LocalNICMTUSize ($name) {
(Get-NetAdapter -Name $name).MtuSize
}
function Get-LocalNICFullDuplex ($name) {
(Get-NetAdapter -Name $name).FullDuplex
@gabrielrojasnyc
gabrielrojasnyc / gist:60b95f734f4b5e14a4f7
Created December 29, 2015 14:20
Dell Warranty Information
# you can replace this with list of servers
#$computers = 1..5 this was for testing purposes
$computers = Get-Content C:\Scripts\test.txt
#Define variable
$DellSystemInfo = $Null
foreach ($node in $computers){
# Get Dell Server serviceTag
$ServiceTag1 =(Get-CimInstance -ComputerName $node -ClassName Win32_ComputerSystemProduct).identifyingNumber