Skip to content

Instantly share code, notes, and snippets.

View spy86's full-sized avatar
🎯
Focusing

Maciej Michalski spy86

🎯
Focusing
View GitHub Profile
@spy86
spy86 / README.md
Created January 24, 2019 13:53
LAB Domain Controller with PowerShell

Setting up the NIC, Renaming the Computer, and Rebooting

# Define the Computer Name
$computerName = "dc1"

# Define the IPv4 Addressing
$IPv4Address = "10.10.100.25"
$IPv4Prefix = "24"
$IPv4GW = "10.10.100.1"
$IPv4DNS = "8.8.8.8"
@spy86
spy86 / InstalledRoles.ps1
Created February 4, 2019 15:14
Show Installed Windows Roles and Features
Import-module servermanager ; Get-WindowsFeature | where-object {$_.Installed -eq $True} | format-list DisplayName
@spy86
spy86 / GetLocalAdminGroupMembers
Created February 4, 2019 15:15
Get Local Admin Group Members
PS C:\> net localgroup administrators
Alias name administrators
Comment Administrators have complete and unrestricted access to the computer/domain
Members
-------------------------------------------------------------------------------
Administrator
GLOBOMANTICS\Domain Admins
localadmin
The command completed successfully.
@spy86
spy86 / InstallWindowsFeature.ps1
Created February 4, 2019 15:17
Install WindowsFeature
Import-module servermanager ; (Get-WindowsFeature -name hyper-v).Installed
Const MSG_RECIPIENT_LIST = "[email protected]"
Const MSG_SUBJECT = "Some Subject"
Const MSG_BODY = "Testing"
Dim olkApp, olkSes, olkMsg
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNamespace("MAPI")
olkSes.Logon olkApp.DefaultProfileName
Set olkMsg = olkApp.CreateItem(0)
With olkMsg
@spy86
spy86 / CheckCores.ps1
Created March 8, 2019 10:05
Check - Number of Cores and Logical Processors
Get-WmiObject –class Win32_processor | ft systemname,Name,DeviceID,NumberOfCores,NumberOfLogicalProcessors, Addresswidth
@spy86
spy86 / GetNetLocalGroup
Created March 8, 2019 10:06
Show Local Groups
PS C:\> Get-NetLocalGroup -Group "remote desktop users" -Computername $sessions
Group : remote desktop users
Computername : CHI-FP01
Members :
Group : remote desktop users
Computername : CHI-WIN8-01
Members :
Computername : CHI-EX01
Members :
Group : remote desktop users
@spy86
spy86 / GetLocalAdminGroupMembers
Created March 8, 2019 10:08
GetLocalAdminGroupMembers
PS C:\> invoke-command {net localgroup administrators} -comp chi-fp01
Alias name administrators
Comment Administrators have complete and unrestricted access to the computer/domain
Members
-------------------------------------------------------------------------------
Administrator
GLOBOMANTICS\Chicago IT
GLOBOMANTICS\Domain Admins
The command completed successfully.
@spy86
spy86 / GetLocalAdminGroupMembers
Created March 8, 2019 10:11
GetLocalAdminGroupMembers
PS C:\> invoke-command {
>> net localgroup administrators |
>> where {$_ -AND $_ -notmatch "command completed successfully"} |
>> select -skip 4
>> } -computer chi-fp01
>>
Administrator
GLOBOMANTICS\Chicago IT
GLOBOMANTICS\Domain Admins
@spy86
spy86 / GetLocalAdminGroupMembers
Created March 8, 2019 10:12
GetLocalAdminGroupMembers
$members = net localgroup administrators |
where {$_ -AND $_ -notmatch "command completed successfully"} |
select -skip 4
New-Object PSObject -Property @{
Computername = $env:COMPUTERNAME
Group = "Administrators"
Members=$members
}