This file contains 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
# See PowerShell Magazine article at ..... | |
$jet = (New-Object System.Data.OleDb.OleDbEnumerator).GetElements() | Where-Object { $_.SOURCES_NAME -eq "Microsoft.Jet.OLEDB.4.0" } | |
if ($jet -eq $null) { | |
if ($env:Processor_Architecture -ne "x86") { | |
&"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" | |
} | |
} | |
$csv = "$env:TEMP\top-tracks.csv" | |
Invoke-WebRequest http://git.io/vvzxA | Set-Content -Path $csv | |
$firstRowColumnNames = "Yes" |
This file contains 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
/** | |
Convert to Roman Numerals | |
Author: Chrissy LeMaire | |
Cohort: M0706 | |
FINAL PROJECT | |
Last Changed: March 10, 2007. | |
*/ | |
import java.*; | |
import java.util.*; |
This file contains 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
https://connect.microsoft.com/SQLServer/feedback/details/2442788/open-source-sqlps-and-publish-code-on-github |
This file contains 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
apt-get -y install apache2 libapache2-mod-auth-kerb ntp ntpdate | |
# make sure time is synced. If behind a fw, use local time server like a DC | |
service ntp stop | |
ntpdate -s ntp.ubuntu.com | |
service ntp start | |
# Go get the beyondtrust (formerly Likewise) package | |
wget http://download.beyondtrust.com/PBISO/8.3/pbis-open-8.3.0.3287.linux.x86_64.deb.sh | |
chmod +x pbis-open-8.3.0.3287.linux.x86_64.deb.sh |
This file contains 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
<# | |
Detailed blog: https://blog.netnerds.net/2016/04/joining-ubuntu-to-an-active-directory-domain/ | |
In this example: | |
1. Fresh install of Ubuntu 15.10 Server | |
2. DNS is set to AD’s DNS servers | |
3. The Active Directory domain is base.local | |
4. The test user is base\adadmin, which has domain admin privs on AD | |
#> |
This file contains 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
# Local user | |
$account = New-Object System.Security.Principal.NTAccount('WorkstationX\Administrator') | |
$sid = $account.Translate([System.Security.Principal.SecurityIdentifier]) | |
# Domain User | |
$account = New-Object System.Security.Principal.NTAccount('base\ctrlb') | |
$sid = $account.Translate([System.Security.Principal.SecurityIdentifier]) | |
# This too, but dang is it slow | |
Get-CimInstance -ClassName Win32_UserAccount -Filter "Caption='base\\ctrlb'" |
This file contains 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
# Setup runspace pool and the scriptblock that runs inside each runspace | |
$pool = [RunspaceFactory]::CreateRunspacePool(1,5) | |
$pool.Open() | |
$jobs = @() | |
# This is the workhorse. | |
$scriptblock = { | |
$source = "Data Source=sqlserver;Integrated Security=True;Connection Timeout=3;Initial Catalog=pssqlbulkcopy" | |
$dest = "Data Source=sql2016;Integrated Security=True;Connection Timeout=3;Initial Catalog=pssqlbulkcopy" | |
$conn = New-Object System.Data.SqlClient.SqlConnection |
This file contains 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
# Solution for http://powershell.com/cs/forums/t/23737.aspx | |
[void][Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | |
$server = New-Object Microsoft.SqlServer.Management.Smo.Server "sqlserver" | |
$servername = $server.netname | |
$sqlinstancename = $server.DomainInstanceName | |
$dbs = $server.databases | Where-Object { 'tempdb','Pubs','Northwind','model' -notcontains $_.Name } | |
$loginreport = @() | |
foreach ($db in $dbs) { | |
$users = $db.users | Where-Object { 'guest','sys','INFORMATION_SCHEMA'-notcontains $_.Name -and $_.Name -notlike '*##*' -and $_.Name -notlike '*$*' -and $_.Name -ne $null } |
This file contains 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 = "sqlserver" | |
$destination = "sqlcluster" | |
$smo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | |
$smoext = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMOExtended") | |
$sourceserver = New-Object Microsoft.SqlServer.Management.Smo.Server $source | |
$destserver = New-Object Microsoft.SqlServer.Management.Smo.Server $destination | |
foreach ($sourcelogin in $sourceserver.logins) { |
This file contains 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
********************** | |
Windows PowerShell transcript start | |
Start time: 20160516223036 | |
Username: BASE\ctrlb | |
RunAs User: BASE\ctrlb | |
Machine: NIMY (Microsoft Windows NT 10.0.14328.0) | |
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | |
Process ID: 6208 | |
PSVersion: 5.1.14328.1000 | |
PSEdition: Desktop |