In an attempt to refactor some of my code, I've added a function to setup an OleDbDataReader.
The return value that I'm getting is for some odd reason a System.Data.Common.DbDataRecord.
Just prior to the function returning the object, I checked to see that it is indeed a DataReader.
Here's the function's code:
function Execute-Reade...
Are there any examples of this? I haven't been able to find anything on google that shows how to implement this design practice using powerboots.
...
I have a class in C# say for example
public class MyComputer : PSObject
{
public string UserName
{
get { return userName; }
set { userName = value; }
}
private string userName;
public string DeviceName
{
get { return deviceName; }
set { deviceName = value; }
}
public str...
Are there any libraries or projects that implement prototypal inheritance for PSObjects in Powershell?
...
I have a powershell script located at d:\temp
When I run this script, I want the current location of the file to be listed. How do I do this ?
For example this code would accomplish it in a dos batch file; I am trying to convert this to a powershell script..
FOR /f "usebackq tokens=*" %%a IN ('%0') DO SET this_cmds_dir=%%~dpa
CD /d "%...
I check out a working copy of a project using Checkout-WorkingCopy and later delete the directory using Cleanup-WorkingCopy (the code for these functions is at the end of this post).
Problems I am facing:
Instead of echoing "Checking out from svn://somePath1 to C:/somePath2" it echoes "Checking out from svn://somePath1 C:/somePath2 to...
Is there any problems with creating a powershell runspace in an asp.net application and running commands?
I have a basic example working fine but I'm wondering if there are any pitfalls waiting for me.
I'm particularly wondering:
Is this an a light-weight inprocess operation or is it firing up another processes that could lead to unp...
I have an access table in 2007 that is linked to a sharepoint list. When a new record is added to the sharepoint list, the change does not get automatically reflected in the access table. If you right click on the linked table, there is an option to "refresh list" which does exactly as you would expect.
My question is how to perform t...
Currently I have a one line batch file to back up a file. I run it manually when I need to back up a file. The only thing I would like to add to it is the current date. Here is what I have:
xcopy /W /Y ACTIVE.DB ACTIVE.DB.BACKUP
the destination file should simply be ACTIVE.DB.BACKUP.YYYYMMDD. How would I go about creating a script ...
I have a string
[Test: ABC.Test (6)] MORETEXTGOESHERE [(null)] <(null)> - A red fox jumped the fence
and would like to trim the string to only show
A red fox jumped the fence
What is the best way to go about it. I'm sure I'll manage with SubStrings and IndexOfs but perhaps some regex expression could do the trick?
...
Hi,
I'm trying to run Send-MailMessage directly from a command window.
c:>powershell Send-MailMessage -from '[email protected]' -to "[email protected]" -subject 'test' -smtpServer "srv.server.com" -Attachment c:\Test\log.txt -body "Test message"
This fails with
Send-MailMessage : A positional parameter cannot be found that accepts argumen...
i'm trying to get QuickTest.Application and QuickTest.RunResultsOptions com objects. But when i access them this way:
$qtp_app = New-Object -comobject QuickTest.Application -strict
$qtpapp = $qtp_app | Get-Member
$qtp_RunOpt = New-Object -comobject QuickTest.RunResultsOptions -strict
$qtprunopt = $qtp_RunOpt | Get-Member
i don't get...
I have a lot of tabs open in Firefox. After I close firefox and then run it again, the tabs are there, that's all right.
However, from time to time, Firefox crashes and my tabs are lost. I would like to somehow get the open tabs and backup the list to some file. Any ideas?
(With tabs in file I can also use git/svn/whatever to store the...
My mission is to graduate from using PowerShell to create an instance of Outlook to simply viewing, or making visible the process that I can see in the TaskManager.
To Digress, this works for Word, but not if I substitute Outlook. for Word.
$MsApp = New-Object -comObject Word.Application
$MsApp.Visible = $true
I have checked the met...
Hi,
I am having problems with a powershell script i basically trying to reset the permission on a folder, by removing the following groups
NT AUTHORITY\Authenticated Users
BUILTIN\Users
If i manually change the folder to not inherit from it parent the script works, I have look through google to find best way of removing the inherita...
The following S.O. question addresses the problem (when you're trying to figure it out from within a script).
http://stackoverflow.com/questions/817198/how-can-i-get-the-current-powershell-executing-file
How would you do it if you were within a function.
The Example below works outside the definition of the function, just not inside.
...
So I've an array-variable of servers that is dynamically created from an external script.
I now need to populate my GUI form with a list of check-boxes for each server. This will work as a selection mechanism when doing deployments to said servers.
As I don't know how many servers are going to be in my list, this form will have to have...
Just getting started with Powershell and have a quick question. Trying to run this statement:
gwmi -query "select Description from Win32_OperatingSystem" | select-object Description
The results come back as:
Description
------------
My PC Name
But I just want MY PC Name. What else to I need to add to the statement to remove the la...
Is there a way to retrieve a function name from within a function.
for example:
function foo {
[string]$functionName = commnandRetrievesFoo
Write-Host "This function is called $functionName" }
PS > This function is called foo
...
Is there a way to get Write-Debug to print a blank line without printing DEBUG:
Ex:
Write-Debug `n
Write-Debug `n # additional parameters or command here
Write-Debug `n
Output :>
DEBUG:
DEBUG:
...