REQUEST A DEMO

Tag: PowerShell

Using Log4Net in PowerShell

September 23, 2009 I was writing some PowerShell this week, and wanted to do some logging.   I’ve blogged in the past about configuring log4net with the fcSDK within Powershell.   However, this method relied on the log4net handling within our SDK. What if I wanted to log before I got to the SDK initialization?   Kevin shared some of his log4net fu, and I put it into Powershell. Configure Logging   Here’s what I came up with:   function configure-logging() { [system.reflection.assembly]::LoadWithPartialName("log4net") > $null; $LogManager = [log4net.LogManager] $global:logger = $LogManager::GetLogger("PowerShell"); if ( (test-path $appSettings["logConfigFilePath"]) -eq $false) { $message = "WARNING: logging config file not found: " +  $appSettings["logConfigFilePath"] write-host write-host $message -foregroundcolor yellow write-host } else { $configFile = new-object System.IO.FileInfo( $appSettings["logConfigFilePath"] ); $xmlConfigurator = [log4net.Config.XmlConfigurator]::ConfigureAndWatch($configFile); } }   Notice that the logging config file is coming from $appSettings. I blogged about this earlier. Logging Config File…

Migrating a case from Clarify into a Zendesk ticket

September 21, 2009 I recently received a request asking how to migrate some data (specifically, cases) from Clarify into Zendesk. Seems the company is in the process of turning off Clarify and rolling out Zendesk.   It’s all about the APIs   We provide a full set of APIs for Clarify within our Dovetail SDK, and Zendesk also provides a set of APIs. So we just need to put them together. PowerShell   I’ve been using PowerShell more and more lately, so I decided to use that as my environment. And because Powershell gives me full access to the .NET framework, I can use classes such as System.Net.WebClient, which makes it easy for me to call the Zendesk REST APIs. Login to Clarify   In a previous post, I showed how to use some common functions in PowerShell for logging into a Clarify database.   . .\DovetailCommonFunctions.ps1 $ClarifyApplication = create-clarify-application;…

More fun with Powershell

September 11, 2009 I was recently working on porting some existing ClearBasic batch (cbbatch) scripts to PowerShell. I’ve blogged in the past about using our SDK with Powershell. For this particular project, I had multiple scripts to port, and I was looking to extract some common functions and utilities, so that they could be used between multiple scripts. Configuration When using the Dovetail SDK, one of the first tasks is to load up the configuration information and connect to the database. That would normally look something like: $connectionString = “Data Source=localhost;Initial Catalog=dovetail;uid=user;pwd=pass" $databaseType = “MSSQL”;     [system.reflection.assembly]::LoadWithPartialName("fcsdk") > $null; [system.reflection.assembly]::LoadWithPartialName("FChoice.Toolkits.Clarify") > $null; $config = new-object -typename System.Collections.Specialized.NameValueCollection; $config.Add("fchoice.connectionstring",$connectionString); $config.Add("fchoice.dbtype",$databaseType); $config.Add("fchoice.disableloginfromfcapp", "false"); $config.Add("fchoice.nocachefile", "true"); #Create and initialize the clarifyApplication object $ClarifyApplication = [Fchoice.Foundation.Clarify.ClarifyApplication]; if ($ClarifyApplication::IsInitialized -eq $false ){    $ClarifyApplication::initialize($config) > $null; } Code for re-use I didn’t want to repeat that in multiple scripts,…

Creating Bug-Free software

June 4, 2009 I've heard some rumblings of late about software companies claiming that they have bug-free software, while behind the scenes they are simply closing bugs that have been opened without actually fixing them. Well, this is certainly a much easier way to create bug-free software that actually having disciplined engineering practices. We can do this pretty easy by simply creating a business rule that calls a script. The business rule Object Type: Change Request Rule Name: Bug Free Rule Set: Best Practices Start Event: Create Conditions: None Action Title: Go bug free Message Type: Command Line Start Action: 0 minutes From: Event Creation Using: Elapsed Time Command Line: C:WINDOWSsystem32WINDOW~1v1.0powershell.exe C:workPowerShellScriptsGoBugFree.ps1 "[Object ID]"   The Script GoBugFree.ps1: $IdNumber = [string] $args[0]; $ClarifyApplication = [Fchoice.Foundation.Clarify.ClarifyApplication] $ClarifySession = $ClarifyApplication::Instance.CreateSession() $qualityToolkit= new-object FChoice.Toolkits.Clarify.Quality.QualityToolkit( $ClarifySession ) $bugSetup = new-object FChoice.Toolkits.Clarify.Quality.CloseCRSetup($IdNumber) $bugSetup.Status = "Will Not Fix" $bugSetup…

Automatic Subcase Creation

November 14, 2007 While working with a customer this week, they asked about automatic subcase creation, similar to Clarify's Task Manager module.   For example, if a new case of type "New Employee" is created, then I want to automatically create 3 subcases: One subcase for setting up network accounts, dispatched to the network queue One subcase for ordering office furniture, dispatched to the furniture queue One subcase for ordering a new computer, dispatched to the hardware queue   This is easily accomplished with a business rule and a simple script. The script   A simple PowerShell script (my favorite new scripting environment) which takes 1 input parameter (a case id number), and then calls the CreateSubcase API that is part of the Dovetail SDK to create subcases and dispatch them to the appropriate queue.   $connectionString = "Data Source=moorea;Initial Catalog=dovetail;uid=gary;pwd=not4youris"; $databaseType =…

cctvtmmain : a useful, but broken, and poorly named, utility for closing child cases

October 26, 2007 We recently received an inquiry from a customer asking about Clarify's cctvtmmain utility. Specifically, it was throwing a useless error message, and they wanted our help. Our first response was WTF is cctvtmmain? A little research, and we discovered that its a utility for working with parent and child cases. From the Clarify documentation: The Enterprise Service Manager uses parent and child cases. With parent and child cases, you can associate a group of problems with a common cause. The parent case identifies the root cause. A child case is a customer problem that arises due to the root cause and is linked to the parent case. A child case differs from a Subcase, which is a way for subdividing a case for parallel work by different employees on the same customer problem. For example, suppose a WAN outage occurs…

Having RuleManager invoke command line scripts

June 26, 2007 I've received a few questions on this recently, so I decided a post is in order.   One of the features in Rulemanager (both the Clarify/Amdocs Rulemanager and the Dovetail Rulemanager) is the ability to have it invoke command line scripts/executables via a business rule action.   For example:   if a case has been in a status of "waiting on customer" for more than 30 days, run a script that will close the case when a new contact is created, run a script that will send the contact data to another system (such as an ERP system) when a case is closed, run a script that will send the customer a satisfaction survey etc.   What kind of scripts can Rulemanager run? Basically, any kind of script or executable, as long as no UI activity or user input is needed.  …
    class='wp-pagenavi' role='navigation'>
  • 1
  • 2