To get help about regular expressions in powershell, at the command prompt:
help about_regular_expression
Oracle Technical
Posts about Oracle databases
List Server Principals (Logins/Users) – SQL Server
use[master] -- SQL Server authentication logins select * from sys.sql_logins -- all logins/users select * from sys.server_principals order by type_desc
Display Job Information – SQL Server
use [msdb] select * from sysjobs select * from sysjobactivity select * from sysjobs_view select * from sysjobhistory order by job_id, step_id
Get last reboot time
systeminfo | findstr /C:"System Boot Time" $BootTime = (systeminfo | find "System Boot Time:").Replace("System Boot Time:","").Trim() $BootTime $Uptime = (Get-Date) - [datetime]$BootTime $Uptime
Display users using sp_who, sp_who2 – SQL Server
-- see users logged - table variable example DECLARE @whotable TABLE ( SPID INT, Status VARCHAR(1000) NULL, Login SYSNAME NULL, HostName SYSNAME NULL, BlkBy SYSNAME NULL, DBName SYSNAME NULL, Command VARCHAR(1000) NULL, CPUTime INT NULL, DiskIO INT NULL, LastBatch VARCHAR(1000) NULL, ProgramName VARCHAR(1000) NULL, SPID2 INT, REQUESTID INT ) INSERT INTO @whotable EXEC sp_who2 select * from @whotable
-- see users logged - temp table example CREATE TABLE #sp_who2 ( SPID INT, Status VARCHAR(1000) NULL, Login SYSNAME NULL, HostName SYSNAME NULL, BlkBy SYSNAME NULL, DBName SYSNAME NULL, Command VARCHAR(1000) NULL, CPUTime INT NULL, DiskIO INT NULL, LastBatch VARCHAR(1000) NULL, ProgramName VARCHAR(1000) NULL, SPID2 INT, REQUESTID INT ) GO INSERT INTO #sp_who2 EXEC sp_who2 GO SELECT * FROM #sp_who2 GO DROP TABLE #sp_who2 GO
Query Connection Data – SQL Server
use [master] go SELECT DB_NAME(dbid) as DBName, COUNT(dbid) as NumberOfConnections, loginame as LoginName FROM sys.sysprocesses WHERE dbid > 0 GROUP BY dbid, loginame order by 2 desc SELECT * FROM sys.dm_exec_sessions where host_name is not null order by login_name go
Get position of a character in a string SQL Server T-SQL
select CHARINDEX(<char>,<columnname>,[<startpoint>]) from <tablename>;
Find a column in a SQL Server Database
use [XYZ] -- your database name go select name, type_desc from sys.all_objects where object_id in (select object_id from sys.all_columns where upper(name)='<your column name>') go
Get Size of all tables in a SQL Server Database
use [<dbname>] go SELECT t.NAME AS TableName, s.Name AS SchemaName, p.rows AS RowCounts, SUM(a.total_pages) * 8 AS TotalSpaceKB, SUM(a.used_pages) * 8 AS UsedSpaceKB, (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB FROM sys.tables t INNER JOIN sys.indexes i ON t.OBJECT_ID = i.object_id INNER JOIN sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id LEFT OUTER JOIN sys.schemas s ON t.schema_id = s.schema_id WHERE t.NAME NOT LIKE 'dt%' AND t.is_ms_shipped = 0 AND i.OBJECT_ID > 255 GROUP BY t.Name, s.Name, p.Rows ORDER BY t.Name
Launch Admin Tools from Windows Command Line
Many of the Windows admin tools can be quickly accessed by launching them from an administrator command prompt.
AD Domains and Trusts
domain.msc
Active Directory Management
admgmt.msc
AD Sites and Serrvices
dssite.msc
AD Users and Computers
dsa.msc
ADSI Edit
adsiedit.msc
Authorization Manager
azman.msc
Certification Authority Management
certsrv.msc
Certificate Templates
certtmpl.msc
Cluster Administrator
cluadmin.exe
Computer Management
compmgmt.msc
Component Services
comexp.msc
Configure Your Server
cys.exe
Device Manager
devmgmt.msc
DHCP Managment
dhcpmgmt.msc
Disk Defragmenter
dfrg.msc
Disk Manager
diskmgmt.msc
Distributed File System
dfsgui.msc
DNS Managment
dnsmgmt.msc
Event Viewer
eventvwr.msc
Indexing Service Management
ciadv.msc
IP Address Manage
ipaddrmgmt.msc
Licensing Manager
llsmgr.exe
Local Certificates Management
certmgr.msc
Local Group Policy Editor
gpedit.msc
Local Security Settings Manager
secpol.msc
Local Users and Groups Manager
lusrmgr.msc
Network Load balancing
nlbmgr.exe
Performance Montior
perfmon.msc
PKI Viewer
pkiview.msc
Public Key Managment
pkmgmt.msc
QoS Control Management
acssnap.msc
Remote Desktops
tsmmc.msc
Remote Storage Administration
rsadmin.msc
Removable Storage
ntmsmgr.msc
Removalbe Storage Operator Requests
ntmsoprq.msc
Routing and Remote Access Manager
rrasmgmt.msc
Resultant Set of Policy
rsop.msc
Schema management
schmmgmt.msc
Services Management
services.msc
Shared Folders
fsmgmt.msc
SID Security Migration
sidwalk.msc
Telephony Management
tapimgmt.msc
Terminal Server Configuration
tscc.msc
Terminal Server Licensing
licmgr.exe
Terminal Server Manager
tsadmin.exe
UDDI Services Managment
uddi.msc
Windows Mangement Instumentation
wmimgmt.msc
WINS Server manager
winsmgmt.msc
Windows Firewall with Advanced Security on Local Computer
wf.msc