Skip to content

Instantly share code, notes, and snippets.

View dfranciscus's full-sized avatar

Dan Franciscus dfranciscus

View GitHub Profile
C:\ > Get-WmiObject -Class Win32_Service | where {$_.startmode -eq 'Auto'} | select Name -ExpandProperty Name | % {Get-Service -Name $_ | Where {$_.Status -eq 'Stopped'}}
requires -Modules PSReleaseTools
<#
.SYNOPSIS
Compares local PowerShell version to Github latest release, installs using installpkg
#>
function Install-PowerShellonMac {
[CmdletBinding()]
param(
#requires -Modules PSReleaseTools
<#
.SYNOPSIS
Compares local PowerShell version to Github latest release, installs using installpkg
#>
function Install-PowerShellonMac {
[CmdletBinding()]
param(
Add-PSSnapin Microsoft.BDD.PSSnapIn
New-PSDrive -Name "MDT" -PSProvider "MDTProvider" -Root "E:\MDT"
$NuGetPackages = choco list --source=nugetserver.domain.com
ForEach ($NugetPkg in $NuGetPackages)
{
$PackageName = $NugetPkg.Split('|')[0]
$Version = $NugetPkg.Split('|')[1]
Import-MDTApplication -Path 'MDT:\Applications\test' -Name $PackageName -NoSource -Commandline "choco install $PackageName -y" -Shortname $PackageName -Version $Version -Enable "True"
}
Add-PSSnapin Microsoft.BDD.PSSnapIn
New-PSDrive -Name "MDT" -PSProvider "MDTProvider" -Root "E:\MDT"
$NuGetServer = 'nugetserver'
$NuGetPackages = choco list --source=$NuGetServer -r
ForEach ($NugetPkg in $NuGetPackages)
{
$PackageName = $NugetPkg.Split('|')[0]
$Version = $NugetPkg.Split('|')[1]
Import-MDTApplication -Path 'MDT:\Applications\test' -Name $PackageName -NoSource -Commandline "choco install $PackageName --source=$NuGetServer -y" -Shortname $PackageName -Version $Version -Enable "True"
Invoke-WUInstall -ComputerName (Get-ADComputer -Filter 'Operatingsystem -like "*Windows Server*"' | Select-Object -ExpandProperty Name) -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out-File C:\PSWindowsUpdate.log } -Confirm:$false -Verbose
Invoke-Command -ComputerName (Get-ADComputer -Filter 'operatingsystem -like "*Server 2012*"' -Properties * | Select -ExpandProperty Name) -ScriptBlock {Get-SmbSession | Select *} | Select-Object PSComputername,Dialect,ClientComputerName,Clientusername
PSComputerName Dialect ClientComputerName ClientUserName
-------------- ------- ------------------ --------------
Server 3.02 172.16.12.90 DOMAIN\Test$
Server 3.02 172.16.12.100 DOMAIN\Test2$
function New-FantasyDraftOrder {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string[]]$Players
)
$Position = 1
$Players = $Players | Sort-Object {Get-Random}
foreach ($Player in $Players)
{
Last login: Sat Dec 2 12:54:50 on ttys000
vpn-59:~ dan$ cd CentOS/
vpn-59:CentOS dan$ ls
Vagrantfile
vpn-59:CentOS dan$ ls -la
total 8
drwxr-xr-x 4 dan staff 128 Nov 4 14:02 .
drwxr-xr-x+ 39 dan staff 1248 Nov 18 09:46 ..
drwxr-xr-x 3 dan staff 96 Nov 4 14:02 .vagrant
-rw-r--r-- 1 dan staff 3015 Nov 4 13:56 Vagrantfile