Skip to content

Instantly share code, notes, and snippets.

View royashbrook's full-sized avatar

Roy Ashbrook royashbrook

View GitHub Profile
$servicenames = "svc1","svc2","svc3"
$services = Get-Service -ComputerName "servername" -Include $servicenames
$services | ft *
$services | Restart-Service
# Set computer name
$c="servername"
$k="\\$c\HKLM\System\CurrentControlSet\Control\Terminal Server"
# Check Setting
reg query $k /v fDenyTSConnections
# Change it to 0, force overwrite of existing values
reg add $k /v fDenyTSConnections /t REG_DWORD /d 0 /f
-- search the jobs for a specific text
select
[InstanceName] = serverproperty('servername')
, j.job_id
, j.name
, js.step_id
, js.command
, j.enabled
from
msdb.dbo.sysjobs j
# set machine and service
$a = "server"
$b = "service name"
# if needed, below could be used to search for wildcard first to find service.
gwmi win32_service -ComputerName $a | where name -like "*service name filter*" | ft *
# or
gsv -c $a | where name -like "*service name filter*"
# view some additional details about the service pre-change (namely, this has path where gsv doesn't)
// originally posted on my blog in 2006
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace parse.eml
{
class Email
{
string _path,_to,_from,_subject,_urls;
class Email
def initialize(p)
@name = p
fc = IO.read(p)
hdr = fc.split(/^\s*$/)[0]
body = fc.sub(".{" + hdr.size.to_s + ",}",'')
@from = /^From: (.+$)/.match(hdr).to_a[0]
@to = /^To: (.+$)/.match(hdr).to_a[0]
@subject = /^Subject: (.+$)/.match(hdr).to_a[0]
using System.IO;
using System.Text.RegularExpressions;
namespace StripCR
{
class Program
{
static void Main(string[] args)
{
nocr(args[0]);
file = ARGV[0]
fc = IO.read(file).gsub(/\r/,"")
File.open(file,'w'){|f|
f.print(fc)
}
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.UI;
using System.Xml;
public partial class _Default : Page
{
static XmlTextWriter xml;
using c = System.Console;
using d = System.IO.Directory;
using di = System.IO.DirectoryInfo;
using fi = System.IO.FileInfo;
using s = System.String;
namespace Glob
{
class Program
{