Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

RebootNotify and SqlBackup utilities added

  • Loading branch information...
commit 8cfa9888a3fdb0c1e98f9fa3fcee24108ca765f7 1 parent 77e110f
@christophwille christophwille authored
View
20 Tools/RebootNotify/RebootNotify.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RebootNotify", "RebootNotify\RebootNotify.csproj", "{431DEC5A-ED03-48CC-A2ED-D24CA1DBBCE7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {431DEC5A-ED03-48CC-A2ED-D24CA1DBBCE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {431DEC5A-ED03-48CC-A2ED-D24CA1DBBCE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {431DEC5A-ED03-48CC-A2ED-D24CA1DBBCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {431DEC5A-ED03-48CC-A2ED-D24CA1DBBCE7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
BIN  Tools/RebootNotify/RebootNotify.suo
Binary file not shown
View
40 Tools/RebootNotify/RebootNotify/Program.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Net.Mail;

Hello @christophwille ,
did you dowloaded the dll of System.Net.Mail or import it to sharpDevelop ?
We are working on university project and we need to send mail throw smtp protocol.

Any help ? thanks

@christophwille Owner

That's part and parcel of the .NET Framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+namespace RebootNotify
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ SendMail();
+ }
+
+ private static void SendMail()
+ {
+ MailMessage mail = new MailMessage();
+
+ mail.From = new MailAddress(GetFromAddress());
+ mail.To.Add(GetToAddress());
+
+ mail.Subject = "Reboot Server: " + Environment.MachineName;
+ mail.Body = "Date/Time: " + DateTime.Now.ToString();
+
+ SmtpClient smtp = new SmtpClient("127.0.0.1");
+ smtp.Send(mail);
+ }
+
+ private static string GetToAddress()
+ {
+ return "wil@emailgwiax.com";
+ }
+
+ private static string GetFromAddress()
+ {
+ return "christophw@alphasierrapapa.com";
+ }
+ }
+}
View
36 Tools/RebootNotify/RebootNotify/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("RebootNotify")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("RebootNotify")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a0864496-19b4-41e6-9a2a-cc41218dcbc9")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
59 Tools/RebootNotify/RebootNotify/RebootNotify.csproj
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{431DEC5A-ED03-48CC-A2ED-D24CA1DBBCE7}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RebootNotify</RootNamespace>
+ <AssemblyName>RebootNotify</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
20 Tools/SqlBackupCSharp/SqlBackupCSharp.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlBackupCSharp", "SqlBackupCSharp\SqlBackupCSharp.csproj", "{DAEC3B8D-3E44-431A-AD29-A4A82DDADA74}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DAEC3B8D-3E44-431A-AD29-A4A82DDADA74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DAEC3B8D-3E44-431A-AD29-A4A82DDADA74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DAEC3B8D-3E44-431A-AD29-A4A82DDADA74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DAEC3B8D-3E44-431A-AD29-A4A82DDADA74}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
BIN  Tools/SqlBackupCSharp/SqlBackupCSharp.suo
Binary file not shown
View
70 Tools/SqlBackupCSharp/SqlBackupCSharp/Program.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Data;
+using System.Collections.Generic;
+
+using Microsoft.SqlServer.Management.Common;
+using Microsoft.SqlServer.Management.Smo;
+
+class Program
+{
+ public static string BaseBackupLocation = @"z:\db\";
+
+ static void Main(string[] args)
+ {
+ List<BackupInformation> backups = new List<BackupInformation>()
+ {
+ new BackupInformation() { Server = @"montferrer\dev", Database ="sdrwiki" },
+ new BackupInformation() { Server = @"montferrer\dev", Database ="sharpdevelopwiki" },
+ new BackupInformation() { Server = @"montferrer\dev", Database ="gemini" },
+ new BackupInformation() { Server = @"montferrer\community", Database ="cs" }
+ };
+
+ foreach (BackupInformation b in backups)
+ {
+ PerformBackup(b);
+ }
+
+ Console.WriteLine("All backups complete");
+ }
+
+ public static void PerformBackup(BackupInformation b)
+ {
+ string backupDeviceName = BaseBackupLocation +
+ b.Database +
+ DateTime.Now.Date.ToString("yyyyMMdd") +
+ ".bak";
+
+ BackupDeviceItem bdi =
+ new BackupDeviceItem(backupDeviceName, DeviceType.File);
+
+ Backup bu = new Backup();
+ bu.Database = b.Database;
+ bu.Devices.Add(bdi);
+ bu.Initialize = true;
+
+ // add percent complete handler
+ // bu.PercentComplete += new PercentCompleteEventHandler(Backup_PercentComplete);
+
+ // add complete event handler
+ bu.Complete += new ServerMessageEventHandler(Backup_Complete);
+
+ Server server = new Server(b.Server);
+ bu.SqlBackup(server);
+ }
+
+ protected static void Backup_PercentComplete(object sender, PercentCompleteEventArgs e)
+ {
+ Console.WriteLine(e.Percent + "% processed.");
+ }
+
+ protected static void Backup_Complete(object sender, ServerMessageEventArgs e)
+ {
+ Console.WriteLine(Environment.NewLine + e.ToString());
+ }
+}
+
+public class BackupInformation
+{
+ public string Server { get; set; }
+ public string Database { get; set; }
+}
View
36 Tools/SqlBackupCSharp/SqlBackupCSharp/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SqlBackupCSharp")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("SqlBackupCSharp")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("8df94579-f18f-4415-becb-100b94d1c417")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
63 Tools/SqlBackupCSharp/SqlBackupCSharp/SqlBackupCSharp.csproj
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{DAEC3B8D-3E44-431A-AD29-A4A82DDADA74}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SqlBackupCSharp</RootNamespace>
+ <AssemblyName>SqlBackupCSharp</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.SqlServer.ConnectionInfo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" />
+ <Reference Include="Microsoft.SqlServer.SmoExtended, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" />
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
Please sign in to comment.
Something went wrong with that request. Please try again.