Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

Planker

@Planker
About
Posts
74
Topics
39
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C# loading Powershellv2 modules
    P Planker

    my issues seem to be that I am doing something incorectly to load the Group policy Powershell module. I am calling invoke after the import-Module command so I can call a cmdlet that is not loaded until the Group policy Module has been loaded. I am getting an exception on the import-Module command that it can't be found so either I am calling the wrong powershell classes or I am setting up my runspace incorectly.

    C# help csharp windows-admin

  • C# loading Powershellv2 modules
    P Planker

    according to this MSDN article http://msdn.microsoft.com/en-us/library/ff458115(v=vs.85).aspx the assembiles are in c:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\V1.0 but when I add these as a reference I get the same unknown command when trying to add the Grouppolicy module any ideas why this is not working?

    C# help csharp windows-admin

  • C# loading Powershellv2 modules
    P Planker

    I edited the Project file to add the Reference

    C# help csharp windows-admin

  • C# loading Powershellv2 modules
    P Planker

    I am having a problem being able to run commandlets that are in modules from C#. when I Invoke the import-module command via ps.AddScript or ps.Addcommand I do not get an error thrown on the second Invoke. can anyone help me figure out what I am doing wrong. PowerShell ps; ps = PowerShell.Create(); ps.AddScript(@"import-module GroupPolicy"); ps.Invoke(); ps.AddCommand("Get-GPO"); try { ps.Invoke(); } catch (RuntimeException runtimeException) { System.Console.WriteLine("Runtime exception: {0}: {1}\n{2}", runtimeException.ErrorRecord.InvocationInfo.InvocationName, runtimeException.Message, runtimeException.ErrorRecord.InvocationInfo.PositionMessage); }

    C# help csharp windows-admin

  • RSOP Collection Com/WMI errer
    P Planker

    using
    GPMGMTLib;

    GPM myGPM = null
    ;
    GPMConstants gpmc = null
    ;
    GPMRSOP myRSOP = null
    ;
    myGPM = new
    GPMClass();
    gpmc = (GPMConstants)myGPM.GetConstants();
    myRSOP = myGPM.GetRSOP(gpmc.RSOPModeLogging, ""
    , 0);
    myRSOP.LoggingComputer = computername;
    myRSOP.LoggingFlags = gpmc.RsopLoggingNoUser;
    myRSOP.CreateQueryResults();
    myRSOP.GenerateReportToFile(GPMReportType.repXML, outputfilename);

    the above code gives the following error System.Runtime.InteropServices.COMException was unhandled by user code Message="Exception from HRESULT: 0x80041003" Source="Interop.GPMGMTLib" ErrorCode=-2147217405 this is my first time programing with COM objects and not really sure how to fix this error, I see that could be a permission issue, I gave myself Domain admin rights and I still can not run the code on the local machine.

    C# help com tutorial

  • How to check if windows feature is installed
    P Planker

    I'm trying to figure out how to tell if a feature is install on Vista SP1 and newer OSs. does anyone know where this is stored at? i need to check if the Group policy management features are installed, it is not listed in the registry for add remove programs... thanks

    C# windows-admin tutorial question

  • backgroundworker problem
    P Planker

    could someone point out what I am doing wrong that the reportProgress method is not working. BackgroundWorker bw = new BackgroundWorker(); public Control() {       bw.WorkerReportsProgress = true;       bw.WorkerSupportsCancellation = true;       bw.DoWork += new DoWorkEventHandler(bw_DoWork);       bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);       bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); } void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { //do updates } void bw_DoWork(object sender, DoWorkEventArgs e)             {                   BackgroundWorker worker = sender as BackgroundWorker;                   if ((worker.CancellationPending == true))                   {                         e.Cancel = true;                                           }                   else                   {                         //work code removed                         totalnumbersoffiles = XmlFiles.Count;                         for (int filecount = 0; filecount < XmlFiles.Count; filecount++)                         {                               //work code removed                               bw.ReportProgress(filecount);                         }  &

    C# help

  • Interacting with web site
    P Planker

    I am wanting to write a service that will log into my account on a web page. my question is what is the best way to connect to the web page, how can I find out if they have an undocumented web service that I can connect too. this is my first time trying to interact with other code that was not my own code. any links that would help me learn how to do this would be great. Thanks

    The Lounge question help tutorial

  • Running embedded WSF Script
    P Planker

    Is it possible to run an embedded WSF script? I know I can run the script if it is external to the program with the System.Diagnostics.Process class but I would like to make this a standalone exe so it is portable. any code examples would be great or the class I should research more. thanks

    C# hardware tools question

  • DataTable Update Access database
    P Planker

    Thanks for the help I ended up using the DataTableReader and got it working.

    C# database announcement

  • DataTable Update Access database
    P Planker

    I am reading a table in from one access Database and storing it in a DataTable(or DataSet if easier) I then want to update an empty table in another database with the data in the DataTable. the two tables have the same fields I know I can read the DataTable row by row and add the data to the 2nd database but I am wondering if there is an easier shorter way. here is the code I am currently working on, (not sure that it will work all of the DataTable/DataSet examples I have found only are working with pulling data and updating from a single database. DataTable HashTable = new DataTable(); Classes.SeedsDB seed = new Classes.SeedsDB(); seed.GetHashTable(ref seedDBPath, ref HashTable); //Opens 1st Database and stores the Table in HashTable OleDbDataAdapter Adapter = new OleDbDataAdapter("SELECT * FROM BadHashTable",MAconn); OpenAccessDB(); //Opens 2nd Database holds connection string that works in other Methods in the class OleDbCommandBuilder Cmdbld = new OleDbCommandBuilder(OSAppsAdapter); Adapter.Update(HashTable); CloseAccessDB();

    C# database announcement

  • Threads / Class / Array
    P Planker

    I have a form that gets a list of files for processing I am storing the path in an sting array then passing the array to a class that does the work on the files. the single thread approach takes about 30 mins to process 100 files and update an access DB (will be ported to SQL soon). Currently the single thread makes the form not responsive. I want to at a minimum move the processing to another thread, possibly setup a thread pool. from what I can tell the time consuming part is updating the DB. I have a few questions before I jump to conclusion of adding 1 thread or a thread pool. 1. will the thread pool solution run into locked file problems when writing to the DB from multiple threads? currently using Jet OLEDB to connect to the DB 2. What is the best way to handle passing the files to the class with threads? Currently I am reading the directory and storing the files in a string array in the form creating the object for the class passing the array to the StoreArray method call the Process method the process method calls another method that handles the interaction with the array I think the answer to my 2nd question with the least amount of rewriting code is to create the object of the class as a form variable, but I'm not sure that that is really the best solution. I'm new to threads and not sure how I can get the data from the Form to the class. below is two of the methods that should show how i am currently doing this (could have errors I didn't cut and paste) ## form1 ### private void btnStart_Click(object sender, EventArgs e) { int count = 0; string dirpath = this.txtxmldir.Text.ToString(); if (dirpath != "") { //new Dir Info object DirectoryInfo di = new DirectoryInfo(dirpath); //load files into array FileInfo[] rgFiles = di.GetFiles("*.xml"); foreach (FileInfo fi in rgFiles) { file[count] = dirpath + "\\" + fi.Name; count++; } } RRRxml ProcessXml = new RRRxml(); ProcessXml.SetFiles(file, count); ProcessXml.Process(); } ## RRRxml Class ### public void Process() { while(Arraycounter > 0) { string FiletoProcess = ReadFiles(); //Read files is in charge of controlling the array counter and returns the file to load xml.Load(FiletoProcess);

    C# question database mobile data-structures xml

  • Writing to an Access DB locks DB
    P Planker

    Thanks, that is what i thought was the answer was but wanted to double check.

    C# database json question announcement

  • Writing to an Access DB locks DB
    P Planker

    I'm writing an app that updates an Access database i am currently using Jet OLEDB connection to run my update querys. My app is parsing a large amount of data and takes about 10 - 15 mins to complete. I have noticed that If i try to access the DB from access while the app is running the Database is locked. Is there a way I can open the DB with out locking the DB for any other write access? thanks MAconn = new OleDbConnection(); MAconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source="+DBPath; MAconn.Open(); MAcmd = MAconn.CreateCommand(); conn_succ = true;

    C# database json question announcement

  • reading XML
    P Planker

    i figured out how to do this below is the code i used, could be cleaner if this was the only thing i was checking in the User node XmlDocument xml = new XmlDocument(); xml.Load(str); XmlNamespaceManager NSM = new XmlNamespaceManager(xml.NameTable); NSM.AddNamespace("abcd", "http://www.microsoft.com/GroupPolicy/Settings"); XmlNode xmln6 = xml.SelectSingleNode("//abcd:User", NSM); for (int i = 0; i < xmln6.ChildNodes.Count; i++) { XmlNode Childnode = xmln6.ChildNodes[i]; if (Childnode.Name == "ExtensionData") { string ExtDataTest = Childnode.ChildNodes[0].Attributes[1].Value.ToString(); string test = ExtDataTest.Substring(3, ExtDataTest.Length - 3) } }

    C# xml database performance help tutorial

  • reading XML
    P Planker

    thanks for the link it has been helpful, I have another question here is the xml i am trying to query ... .....settings I need to read are child nodes here..... Folder Redirection .....settings I need to read are child nodes here..... Registry Is there a way i can query the xsi:type value? if not I can query the name but not sure what the best way to jump up to the settings to read them. this xml file does not always have the same entries so i am checking for all possible cases

    C# xml database performance help tutorial

  • reading XML
    P Planker

    thanks, i just tried this and making some progress now here is what i have to get the text of the whole node and the first child XmlDocument xml = new XmlDocument(); xml.Load(str); XmlNamespaceManager NSM = new XmlNamespaceManager(xml.NameTable); NSM.AddNamespace("abcd", "http://www.microsoft.com/GroupPolicy/Settings"); XmlNode xmln = xml.SelectSingleNode("//abcd:Identifier", NSM); if (xmln.HasChildNodes == true) { if (xmln.FirstChild.Name == "Identifier") { this.textBox2.Text = xmln.FirstChild.InnerText.ToString(); } } this.textBox1.Text = xmln.InnerText.ToString(); is there a better way to do this or should i get coding? and thanks to everyone!!!

    modified on Thursday, November 13, 2008 4:15 PM

    C# xml database performance help tutorial

  • reading XML
    P Planker

    thanks for the tip but the xml code i don't want to change it is an export that i want to import to a database

    C# xml database performance help tutorial

  • reading XML
    P Planker

    i've never used xsd.exe before this project but when i tried to create my own xsd files from the xml it complained about to many nested tables. when i found the MS xsd files i tried to create classes but it is saying something about undefined complexType. if there is a way I can use the MS xsd files then great if not i need to figure out how to parse this xml file the hard way and i know it is going to be a PITA.

    C# xml database performance help tutorial

  • reading XML
    P Planker

    no my last question was using xpath, and not making any progress.... I guess I will stop posting on code project... I'm not asking someone to write this for me, I just have something new and is not working was trying to get someone to help point out what i am doing wrong so i can move forward. sorry for reposting a different but similar question.

    C# xml database performance help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups