powershell

powershell outlook interop send email

I'm developing a script that involves creating an email contact, and forwarding mail to that contact. Last part of the script is to automatically send a test email to the address to make sure the forwarding works. So I use the following code: [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Core") $olApp = new-object...

quest powershell : how do you run scheduled task?

How do you run a scheduled task with Quest powershell snap in? ...

How to convert .cs file to a powershell cmdlet

Can anyone help me to convert a c# .net program to powershell cmdlet. I am very new to this area. plz help me to get out of this checkpoint. Regards Arun ...

Data Warehouse Management Command Line Application - PowerShell or C# Console App

I'll preface this question by saying this is for a Microsoft only shop. If you were to write a console app to manage a data warehouse what would you use: 1) Writing a custom environment for PowerShell (ala the latest flavors of Exchange / SQL Server) 2) Write it as a C# Console App If #2 are there any frameworks that offload writin...

Filter services when calling Get-Service

Hi, I did this in the past, and can't remember the correct command (I think I was using instring or soemthign?) I want to list all the windows services running that have the word 'sql' in them. Listing all the windows services is: Get-Service Is there a instring function that does this? ...

AD group comparison - PowerShell

When using the following function (compare 2 user's group membership), I get results that do not make sense. function Compare-ADUserGroups { #requires -pssnapin Quest.ActiveRoles.ADManagement param ( [string] $FirstUser = $(Throw "logonname required."), [string] $SecondUser = $(Throw "logonname required.") ) $a = (Get-QADUser $F...

Is it possible to write a script to easily deploy clr stored procedures?

I would like to include CLR stored procedure deployment in our deployment script (powershell at the moment), however I can't figure out a nice way to do this automatically. I would have thought there would be a nice command line option to do the same as right-click deploy in Visual studio ...

.Net Windows Update Querying

Hi all, I was curious if there's a .Net API that would allow me to identify what updates are pending for "Windows Update," failing that, is there a windows powershell command that can get it? ...

About consistensy in the powershell scripting language, using .NET types

If I want to create a .NET object in the powershell I write something like the following: [System.Reflection.Assembly]::LoadWithPartialName("System.Xml") | out-null" $doc = new-object -typename System.Xml.XmlDocument" If I want to call a static .Net method I use a command similar to the following line: $path = [System.String]::Format...

WMI/PowerShell Bug: why is CreateSite creating *two* sites all of the sudden?

I have a simple PowerShell script that uses WMI to create a web site on a Vista box. Yes, I know PowerShell has an IIS provider for working with IIS 7, but this script must also support IIS 6.0, so that rules that out. Anyway, the script was working just fine, but all of the sudden (and I mean that literally, I made zero code changes t...

how to create a cmdlet?

I have written my program in c# .net. I want to convert it in to a powershell cmdlet. I was instructed to use pssnapin and getproc programs. Can anyone plz help me out.. Regards Arun ...

What does the "@" symbol do in Powershell?

I've seen the @ symbol used in PowerShell to initialise arrays. What exactly does the @ symbol denote and where can I read more about it? ...

What's the best way to start and stop SQL Server from the command line?

I need to start and stop SQL Server from the command line. I am willing to write a small C# program if necessary, but I suspect that there's something (PowerShell, maybe?) that currently exists that does this gracefully. Thank you ...

Connecting to WMI: 0x800706ba errors on some machines (but not all)

When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable). If I turn the firewall off on the remote machine, the queries start working. I have tried a bunch of different configurations of firewall settings,...

Is it possible to customize error display in powershell?

I find the standard Powershell display of errors (red text, multi-line display) a bit distracting. Is it possible to customize this? ...

How do I create an application in IIS 5.0 using powershell?

I've worked out how to interact with IIS 6.0, but I can't find anything on the net about how to talk to IIS 5.0 - if indeed it's even possible? I would like to write a script to create a temporary application, so I can copy some ASP.NET files there, build them, and then remove the temporary application. If needs be I am happy to call a...

powershell command to restore remote database

Does anyone know the powershell commands to restore a remote database from a local file? ...

Is there a Windows command shell that will display Unicode characters?

Assuming I have fonts installed which have the appropriate glyphs in them, is there a command shell for Windows XP that will display Unicode characters? At a minimum, two things that should display Unicode correctly: Directory listings. I don't care what I have to type (dir, ls, get-childitem, etc.), so long as files with Unicode chara...

How to use Powershell to grant user rights to registry keys?

I need to grant rights to Widnows user group Everyone to the HKCR hive and all the keys below th HKCR.I would like to use PowerShell scripting for this. Is it possible? ...

Create local user with PowerShell (Windows Vista)

I've installed PowerShell recently and one of the first things I started looking for was how to create a new user. After looking for some time I still haven't found this. I have a little experience in bash on linux and find it very effective. Creating users there is trivial. Is there an easy\built-in way to create a local user with Power...