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
# "2015-11-18 18:02:55Z" | |
(get-date).ToUniversalTime().toString("u") | ConvertTo-Json |
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
REM by deploying one at a time, an incorrectly types package name does not bomb entire installation | |
for %x in (async aws-sdk backbone body-parser bower browserify chalk cheerio cli-color coffee-script colors commander connect cordova debug express forever fs-extra glob grunt grunt grunt-cli gulp handlebars jade jquery karma less lodash log4js mime minimist mkdirp moment mongodb morgan mustache oauth optimist passport pg phantomjs pm2 promise q react redis request rimraf semver socket.io statsd tedious through through2 uglify-js underscore uuid validator when winston wrench yo) do npm install -g %x | |
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
# http://dacosta9.wordpress.com/2014/02/26/connecting-to-sql-server-with-r-with-rjdbc/ | |
# reference document on RJDBC | |
# http://cran.r-project.org/web/packages/RJDBC/RJDBC.pdf | |
# install.packages("RJDBC",dep=TRUE) | |
library(RJDBC) | |
drv <- JDBC("com.microsoft.sqlserver.jdbc.SQLServerDriver" , "/Users/johndacosta/Downloads/sqljdbc_4.0/enu/sqljdbc4.jar" ,identifier.quote="`") | |
conn <- dbConnect(drv, "jdbc:sqlserver://192.172.1.210:55158;databaseName=master", "sa", "password") | |
d <- dbGetQuery(conn, "select * from sys.databases where database_id <= 4 ") | |
summary(d) |
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
# http://dacosta9.wordpress.com/2014/02/26/connecting-to-sql-server-with-r-with-rjdbc/ | |
# reference document on RJDBC | |
# http://cran.r-project.org/web/packages/RJDBC/RJDBC.pdf | |
# install.packages("RJDBC",dep=TRUE) | |
library(RJDBC) | |
drv <- JDBC("com.microsoft.sqlserver.jdbc.SQLServerDriver" , "/home/johndacosta/C/jdbc/sqljdbc_3.0/enu/sqljdbc4.jar" ,identifier.quote="`") | |
conn <- dbConnect(drv, "jdbc:sqlserver://192.172.1.210:55158;databaseName=master", "sa", "password") | |
d <- dbGetQuery(conn, "select * from sys.databases where database_id <= 4 ") | |
summary(d) |
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
# http://dacosta9.wordpress.com/2014/02/26/connecting-to-sql-server-with-r-with-rjdbc/ | |
# http://cran.r-project.org/web/packages/RJDBC/RJDBC.pdf | |
# install.packages("RJDBC",dep=TRUE) | |
library(RJDBC) | |
drv <- JDBC("com.microsoft.sqlserver.jdbc.SQLServerDriver" , "C:/jdbc/sqljdbc_4.0/enu/sqljdbc4.jar" ,identifier.quote="`") | |
conn <- dbConnect(drv, "sqlserver://192.172.1.210:55158;databaseName=master", "sa", "password") | |
d <- dbGetQuery(conn, "select * from sys.databases where database_id <= 4 ") | |
summary(d) | |
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
-- http://msdn.microsoft.com/en-us/library/ms181338.aspx | |
select | |
@@servername as ServerName, db_name(dbid) as DatabaseName,dbid,fileid,groupid, size, size * 8 sizeKB, maxsize, growth, status, name, filename | |
from master.dbo.sysaltfiles |
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
\Memory\% Committed Bytes In Use | |
\Memory\Available Bytes | |
\Memory\Available KBytes | |
\Memory\Available MBytes | |
\Memory\Cache Bytes | |
\Memory\Cache Bytes Peak | |
\Memory\Cache Faults/sec | |
\Memory\Commit Limit | |
\Memory\Committed Bytes | |
\Memory\Demand Zero Faults/sec |
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
\LogicalDisk(*)\% Disk Read Time | |
\LogicalDisk(*)\% Disk Time | |
\LogicalDisk(*)\% Disk Write Time | |
\LogicalDisk(*)\% Free Space | |
\LogicalDisk(*)\% Idle Time | |
\LogicalDisk(*)\Avg. Disk Bytes/Read | |
\LogicalDisk(*)\Avg. Disk Bytes/Transfer | |
\LogicalDisk(*)\Avg. Disk Bytes/Write | |
\LogicalDisk(*)\Avg. Disk Queue Length | |
\LogicalDisk(*)\Avg. Disk Read Queue Length |
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
## Invoke by Running .\Get-SQLServerDatabaseUsers.ps1 SQLSERVER\INSTANCENAME | |
## Gets List of Applications, Users and Host Names from SQL Server Default Trace | |
param( | |
[string] $ServerInstance = $(Throw "Provide a SQL Server Instance Name as first parameter") | |
) | |
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO'); | |
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | |
$QueryApplications = "SELECT DISTINCT t.ServerName,t.DatabaseName, t.DatabaseID,t.NTUserName,t.NTDomainName,t.HostName,t.ApplicationName,t.LoginName,t.DBUserName,t.LinkedServerName,t.SessionLoginName | |
FROM sys.fn_trace_gettable(CONVERT(VARCHAR(150), ( SELECT TOP 1 f.[value] FROM sys.fn_trace_getinfo(NULL) f WHERE f.property = 2 )), DEFAULT) T" | |
$QueryApplicationsResults = Invoke-Sqlcmd -ServerInstance $ServerInstance -Query $QueryApplications |
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-WmiObject win32_volume | Select-Object SystemName,Name, BlockSize, Capacity, FreeSpace, DriveLetter , @{Name="CapacityGB";Expression={[math]::round($_.Capacity/1GB,2)}}, @{Name="FreeSpaceGB";Expression={[math]::round($_.FreeSpace/1GB,2)}} , @{Name="FreeSpacePercent";Expression={[math]::round(($_.FreeSpace/($_.Capacity*1.00))*100.00,2)}} , @{Name="Date";Expression={$(Get-Date -f s)}}| Sort-Object Name | Convertto-JSON | |
# This format will allow you to filter on drive name and select a remote computer. | |
# Get-WmiObject win32_volume -ComputerName ServerName | Where-Object {$_.label -match "S\:.*"} | Select-Object SystemName,Name, BlockSize, Capacity, FreeSpace, DriveLetter , @{Name="CapacityGB";Expression={[math]::round($_.Capacity/1GB,2)}}, @{Name="FreeSpaceGB";Expression={[math]::round($_.FreeSpace/1GB,2)}} , @{Name="FreeSpacePercent";Expression={[math]::round(($_.FreeSpace/($_.Capacity*1.00))*100.00,2)}} , @{Name="Date";Expression={$(Get-Date -f s)}}| Sort-Object Name | Convertto-JSON |