Export the VisualSVN Server User Access Rights Using WMI in C# - c#

I need to console application to load the VisualSVN Server User Access Rights to the excel file.
Initially, I started with VBScript to do this. But in VBScript it is very hard to compare two csv files. So currently I'm looking into C#.
Is any sample to code to do this in C# like VBScript in "http://www.svnforum.org/threads/38790-Access-Rights-Reporting-in-Subversion-or-Viusal-SVN"?
If it is quit easy in PowerShell, We will consider PowerShell too. But I don't have experience with PowerShell. Can anyone please redirect me to the Sample code to do the same.

VisualSVN Server 3.4 comes with a PowerShell module which provides a number of cmdlets for server and repository administration (works locally or remotely).
Getting a list of access rules with VisualSVN Server 3.4 is as simple as running Get-SvnAccessRule cmdlet in PowerShell.
For the complete list of PowerShell cmdlets and usage examples, read the article VisualSVN Server PowerShell Cmdlet Reference.

Related

Connect-Msolservice error after publishing the code to Azure Web App

I was developing an Asp.Net web application that will execute particular PowerShell Commands for Office 365. The code contains two parts of the commands (Exchange Online and MSOnline Command). The code is working fine locally on my PC. But When I published the code into Azure Web App the Exchange Online Commands are working as I expected it, but MSOnline commands are giving the below error:
The term 'Connect-MsolService' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again.
I am sure that this error has raised because it did not find the matched MSOnline dlls files to import the module. I have added the dll's using Kudo but also the same. anyone have any idea how to solve this one.
Thank you always
Doing some reading here and here, it looks like you aren't allowed to install the prerequisites needed unless you upgrade (the answer in that second link describes that).
I have had to do this too: call PowerShell from C# for Office 365 administration, so I feel your pain :) although we host on a normal Windows server.

How to run Office365 powershell in Azure Webjob?

I have a program which uses Office 365 Powershell to query O365 information. it works fine. Now, we want to use Azure and put this part into a webjob.
Now, we can pass the credentail into the powershell (using C# code), but when it runs as a webjob, it always shows error, see the screen shot. It says that the cmdlet is not recognized.
I know even on our local machine, we will need to install Windows Azure Active Directory Module to run Office365 powershell. Could the error be because in the Azure, it does not have this module?
So the question is: is there a way to install/integrate this into Azure webjob? or, is there other way that we could run Office 365 powershell in Azure webjob?
Thanks

Using C# to invoke powershell server commandlets to Enable-WindowsOptionalFeature netfx3

I am working on a WiX installer that uses Burn and therefore has a .Net requirement. Bundling the prerequisite version of .Net does not work on server OS's as they require the role manager to be used. The fact that it's part of a WiX install is not really of overwhelming importance it's there in case there are other methods to help me accomplish my task. I am running/testing the code below as a standalone .Net Console application. After failing using this method in order to work around this I wrote the following use powershell and "Enable-WindowsOptionalFeature".
static void Main(string[] args)
{
PowerShell ps = PowerShell.Create();
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
Command addDotNet = new Command("Enable-WindowsOptionalFeature");
addDotNet.Parameters.Add("-FeatureName netfx3 -Online -All");
pipeline.Commands.Add(addDotNet);
Collection<PSObject> log = pipeline.Invoke();
}
When I run it this window pops up.
Windows Server roles and features cannot be automatically installed or uninstalled via the Windows Features Control Panel.
Seeing as how I figured I was already using the equivalent of "Server Manager cmdlets" I'm not sure what it's actually asking for. So the two part question is 1) What is the proper way to work around this issue. 2)How do I keep it quiet during install.
PS: If this question really belongs to Server Fault let me know.
Enable-WindowsOptionalFeature is part of the DISM, it would be used to create a windows image to deploy to a new system
Add-WindowsFeature is the one you are looking for, it adds a feature to the current instance of Windows Server. It is in the ServerManager powershell module, which is only available on Windows Server (not on Windows 7)
All I'm going to say is based on common sense, rather than on prior experience, so sorry if this is not relevant.
You seem to be able to be on Windows Server 2012 as only this version has Windows ADK that you are using. Windows 8 (client os )nd Windows Server 2012 (server os) have differen ways of enabling feature. Those surfaced as Optional Features in Windows 8 but as Server Roles/Features in the server.
Note, that contrary to what you say, the bundle does not work not because it's a server OS it does not work because it's included with the OS and need to be enabled. This applies both to server OS (Win 2012) and client OS (Windows 8).
It's just that you need to use different methods for Windows 8 and Win 2012.
For Windows 8 your method could work. For Windows 2012 the help you are seeing suggest that you use Add-WindowsFeature cmdlet.
Basically, the command fails, because the component you need to install is not present in the component store. The administrator needs to insert the install media. Perhaps you could include the respective file(s) with your installer to avoid that manual step, but I've never tried that and it might also pose a licensing problem.
For Server 2012 Microsoft decided to remove the .NET framework 3.5 from the component store by default. It's still present on the install media, just not spooled onto the disk during installation. I wrote a rant about this in my blog a while ago.
I added some additional logging/writeline statements while trying to figure out where things were broken in the server 2012 instance. I realized that those debug lines were not output to the console at all.
It turns out that I was not READING the pop-up closely enough. The complaint was not about using the PS commandlets, but a complaint about trying to install .Net 3.5 to run my app. My app was targeting .Net 3.5 so the message was about the attempt to automatically install .Net 3.5
May this question be more than a testament to my momentary blindness and stupidity, but also serve as commentary on the importance of paying attention to detail and reading the error understanding why it's occurring. :)

How to execute sql scripts other than OSQL command?

In my product we are using OSQL to execute the sql script files. Unfortunatly some clients don't have OSQL installed in their machine. They don't agree to install sql management studio for license issues.
Is there any alternative to execute the sql scripts rather than OSQL through c# ?
SQLCMD.EXE will be installed in the SQL Server binn directory on the server. You will need SQLCMD.EXE on the client, where your application runs. You can install the SQLCMD.EXE and other command line utilities separately, see Microsoft® Command Line Utilities 11 for SQL Server®.
But is not necessary to install SQLCMD, writing a C# script executor is fairly trivial. In fact I wrote one myself, see https://github.com/rusanu/DbUtilSqlCmd and is also available as a NuGet.
I think SSMS is free for download from microsoft portal and there are no licence issues with it. Check this

Automating C# web app Deployment processes, using secure remote desktop access, and recent svn changes

I want to create an application that will automate a very specific build process that is repeated daily.
I need to build a C# web app, package the dlls and other necessary files (diff from last checkin in svn) into a .zip file in a certain structure.
Connect to a secure remote Windows web server (with specific authentication), copy, unzip and deploy the files to the correct locations.
I was thinking a C# console app which will handle the connection to the remote server, and a combination of file operations in the code, or batch files run on the local machine and the remote server. I intend to use batch script to build the Visual Studio project, and run a diff on the svn tree and export changed files to a certain directory structure.
Is this at all possible? How would I achieve the remote connection and copy the files?
Just wanting to see your thoughts.
Thanks for any help.
What you're trying to create is effectively build automation for which there are some excellent continuous integration products available. My advice would be to jump on the free, Professional version of TeamCity and use this to orchestrate your builds. It plays great with SVN and has built-in Visual Studio and MSBuild runners.
While you're there, unless you're trying to do something very bespoke, take a look at using Web Deploy to push the app out. There's a five part blog series titled You're deploying it wrong! which walks you through the entire process.

Categories

Resources