I want to exclude all directories from my search in PowerShell. Both FileInfo and DirectoryInfo contain Attributtes property that seems to be exactly what I want, but I wasn't able to find out how to filter based on it. Both
ls | ? { $_.Attributes -ne 'Direcory' }
ls | ? { $_.Attributes -notcontains 'Direcory' }
didn't work. How can I...
Our daily feed file averages 2 GB in size. These files get archived to a single zip file at the end of each month and stored in a network share. From time to time, I have a need to search for certain records in those files. I do this by connecting by remote desktop to the shared server, unzip the files to a temp folder, run grep (or Powe...
Hi,
I am am a longtime Linux user but am new to Windows and PowerShell. I just installed Windows7 and Strawberry Perl 5 for the first time. I now want to do a simple command-line print with Windows PowerShell.
It looks like Perl installed correctly:
PS C:\Users\Me> perl -v
This is perl, v5.10.0 built for MSWin32-x86-multi-thread Cop...
I'm trying to run my Silverlight tests via a command line (eventually MSBuild) working from this example.
It all works fine on my XP Box but on Build Machine (Windows Server 2008) the IE window opens, then a second window opens with the Silverlight page in it. That page then shows the "Download Silverlight" picture and link. If I copy t...
I'm trying to figure out how to use PowerShell V2's Send-MailMessage with gmail.
Here's what I have so far.
$ss = new-object Security.SecureString
foreach ($ch in "password".ToCharArray())
{
$ss.AppendChar($ch)
}
$cred = new-object Management.Automation.PSCredential "[email protected]", $ss
Send-MailMessage -SmtpServer smtp.gmail.c...
I am creating a script that retrieves data from a local oracle db. As of now I have the oracle data provider for .net installed. However, this is a big file and a long installation process. Is there a way to deploy a software that utilizes the System.Data.OracleClient without having to install the data provider?
...
Hi All,
I am writing a PowerShell wrapper for an existing Perl script. The Perl script is fed a couple of parameters and goes off and configures all our HP iLO devices for us, and returns the results in an XML format. The problem is the result comes out as one big blob of multiple XML statements ie:
$strResult = & "perl locfg.pl -s $il...
In my Powershell provider, which is a business-logic layer over an SQL database, the Powershell drives equate to database connection settings. This collection of connection settings is persisted to an encrypted XML file on the local computer. An administrator may add these PS drives on a computer, supplying SQL Server credentials, that...
I'm working on a .net application that needs interact with Exchange, specifically creating Exchange objects. Its a web based application, but will have a back end running as a service on the Exchange server.
I'm trying to decide the best way to interact with Exchange. My initial thoughts was to use powershell, with some sort of service ...
I have a file that is tab delimited. I would like a powershell script that counts the number of tabs in each line. I came up with this:
${C:\tabfile.txt} |% {$_} | Select-String \t | Measure-Object | fl count
it yields 3, Which is the number of lines in the file.
any pointers to what I'm doing wrong? I would like it to print a sin...
I am trying to open a web page with a Silverlight App from a batch file on a Windows Server 2008 box.
If I put this in the batch file:
start iexplore http://www.google.com
The google page shows.
If I put this in the batch file (where TestPage has a Silverlight Application):
start iexplore http://www.mysite.com/Configure/TestPage.ht...
I have a powershell script that creates some private queues for me. However, the queues default to being owned by whoever ran the install script. I'd prefer to have them owned by a group (i.e. - Administrators or some such). Anybody know how to do this?
foreach($strQueue in $strQueues) {
if (![System.Messaging.MessageQueue]::Exists...
I'm trying to recursively rename a bunch of TFS folders using tf rename, PowerShell and a regular expression but I'm having some issues with PowerShell as I haven't spent much time with it. This is what I've put together so far to replace a leading 5 with 2.3.2 but it isn't working:
dir | foreach { tf rename $_ { $_.Name -replace '^5',...
At the moment I am using powershell hosted in an asp.net app to communicate with Exchange, and create Exchange objects. Does anyone know of any other means of interacting with Exchange? These methods need to allow the creation of items such as mailboxes and distribution lists, so Exchange Web Services is out.
...
We use NAnt extensively for our build system. Recently, I've written a couple PowerShell Cmdlets to perform a few database related things. At first, the intent of these Cmdlets was not to necessarily run within our build process. However, this has recently become a need and we would like to run a few of these Cmdlets from our NAnt based ...
How do you find out the last log-in time for a windows machine(any user) through powershell?
...
Trying to determine if there are any user folders on the network that don’t have an associated user account. All results return "Missing" when the majority should return "Found". Any ideas?
$Dir = "\\ServerName\Share\"
$FolderList = Get-ChildItem($Dir) | where {$_.psIsContainer -eq $true}
$UserList = get-qaduser -sizelimit 0 | select Lo...
I am having a difficult time reading an XML file with Cdata inside.
in $xmlsource
<list>
<topic>
<topicTitle>Test</topicTitle>
<topicDetail><![CDATA[<br>randomHTMLhere</br>]]></topicDetail>
</topic>
</list>
powershell
[xml]$xml = get-content $xmlsource
foreach ($topic in $xml.list) {
$topic.topicTitle
$top...
I'm looking for a IRC client library/script written in PowerShell. The goal is to replace a Perl script that uses Net::IRC to communicate with a MindAlign channel.
SmartIrc4net will do in a pinch, but I'd rather have a pure implementation for simplicities sake.
Ideas?
...
You can exit Powershell by typing exit. So far so good. But what exactly is this?
PS Home:\> gcm exit
Get-Command : The term 'exit' is not recognized as the name of a cmdlet, function, script file, or operable program. Ch
eck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 ch...