Group:  English: General ยป microsoft.public.windows.powershell

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Threads Replies Last Post
22 Pages: 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  
Extracting regular expression match from file
I think this should be easy, but I'm not having much luck here. I'm sure someone can help me out. I'm trying to extract some text from a couple of files in a directory. I want to then take the extracted data and put it into another file. So, I'm trying to match: "Email: someemail@somewhere.com" This should be pretty simple. Here's what I do so far: $pattern = [regex] "Email: (?<email&...
3 18.06.2007 07:41:31
RunAs PowerShell - Ctrl+C no longer works...
Whenever I run PowerShell using RunAs in Windows XP, the Control+C key sequence no longer works. An example... If I run "ping.exe -t" which will ping endlessly, the way you get back to the command prompt is by pressing CTRL+C. If I run PowerShell under my user context, this works fine. If I run PowerShell as an admin, it's as if CTRL+C is ignored. I have to "X" to close the wind...
10 18.06.2007 04:21:03
Searching large text files
I have very large text files (100MB-500MB+) that I need to process in order to extract useful pieces of information. Unfortunately, I can't find an efficient way of doing this with powershell as get-content tries to pull the entire contents of the file into memory and doesn't seem to store it there very efficiently. While I have 2GB of memory on my machine, I keep getting System.OutOf...
13 18.06.2007 01:30:50
Select-String problem
I'm bummed that Select-String is failing me here: 224# Select-String '^Test' '\\machine\c\Program Files\Acme\Wino\Output\output1.txt' Select-String : The file can not be read: \\machine\c\Program Files\Acme\Wino\Output\output1.txt At line:1 char:14 + Select-String <<<< '^Test' '\\machine\c\Program Files\Acme\Wino\Output\output1.txt' But my trusty old MKS grep.exe works:...
4 17.06.2007 17:18:25
Level setting
I have heard of service providers using Powershell to write a script that will "level set" PC's. Allowing us to insert a CD in each new PC we are managing and have them all have the same configuration. Is this possible and has anyone done it? ...
1 16.06.2007 16:39:01
Scripting / Logging Gripe Summary
This is a multi-part message in MIME format. ------=_NextPart_000_0672_01C794AF.07CD9650 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I finally got a series of Korn shell scripts ported over to PowerShell. = I did this for my team as part of getting them to adopt PowerShell as = the "official" scripting language. :-) Here's what I foun...
12 16.06.2007 08:50:47
Adding Attributes to nodes in XML
I'm working my way through Bruce Payette's book "Powershell in Action." Let me add my recommendation for this book. It's very well written and it's interesting to see some of the design tradeoffs that he notes. One of the chapters is online at http://www.microsoft.com/technet/scriptcenter/topics/winpsh/payette3.mspx He explains how to add an attribute to the top level document, a tiny...
3 16.06.2007 01:38:36
Accessing Metadata
Is there a way to access file metadata? For example the extended information tagged with photos, mp3s etc. Thanks. Brian...
4 15.06.2007 21:31:07
How to display the line number from -switch -regex -file?
I need to search a bunch of makefiles and find the ones that contain a line with '/D' but not 'SSLabel'. I can do with this the following one-liner: 149# gci -r -i makefile |% { $f=$_; switch -regex -file $_ { "(?<!\s +SSLabel.*)/D" { $_ + " : " + $f.FullName; } }} Which works well enough, but it would be even nicer if it would display the line-number of the match from the file? R...
2 15.06.2007 15:52:01
Test for an object that is nothing
Hi Is there a way in powershell to determine if an object is nothing? In vb.net I would use: If var is nothing then ... What is the Powershell equivalent? Dave Coate, MCSE ...
8 15.06.2007 07:11:41
passing a combobox object as function argument
This is a multi-part message in MIME format. ------=_NextPart_000_00B1_01C7AED0.F4E8B330 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I'm having trouble passing an combobox object as a function argument. = The objhect seems to be referring to a null value when I try to access = the methods. Do I need to cast this in a special way? Th...
3 15.06.2007 05:26:04
Problems sending data with System.Net.Sockets.Socket
Hi all For the last few days, I've been practicing my PS scripting by trying to write a simple IRC client. So far I've only come up with this: -- Begin Script -- #Initialize ASCIIEncoding object and create a Socket $ASCIIEncoder = New-Object System.Text.ASCIIEncoding $Socket = New-Object System.Net.Sockets.Socket ([System.Net.Sockets.AddressFamily]::InterNetwork, [System.Net.Sockets....
1 15.06.2007 02:22:42
Set-Content not updating file after get-content and forEach-Object
I have a file I need to append a value to the end of a specific line of text (in a random location in the file). First entry works (replaces text in file) second one does not update file at the end of the line. I can't use the first entry because I can't do a -replace. 1# (get-content $file) | foreach-object {$_ -replace "Group Membership","My Membership"} | Set-Content $file 2# ...
2 15.06.2007 02:01:48
Help with this output: {C05S02, VC05S02}
Got a little PS script that finds the active virtual sqlhost(s) on a clustered host but the output is an ojbect and I'm trying to get to the text. Can't seem to get to it. PS F:\Proj\SQLSBuild> $candidate = "C05S02" PS F:\Proj\SQLSBuild> $c = new-object -comobject MSCLuster.Cluster PS F:\Proj\SQLSBuild> $c.open($candidate) PS F:\Proj\SQLSBuild> $c.Resources | Where-Object -Fil...
8 14.06.2007 21:25:02
Eventlog -list on a DIFFERENT machine
I have tried on my own for about an hour to obtain a list of Eventlogs on a different server. I know about get-Eventlog -list And thanks to Brandon I have got this script working $Log = "Application" $Server = "BigServer" $Evtlog = New-Object System.Diagnostics.Eventlog($log,$server) $Evtlog.Entries | select -first 50 Question: How can I obtain a list of Event Logs on a networ...
6 14.06.2007 20:04:32
Command doesn't work in PowerShell term but works in DOS term
Hi, I am doing a command: net share testy=c:\test /remark:"test" /grant:"domain1\account1",full which works in a DOS command shell but not in the PowerShell shell. Can someone tell me why? Is it the quotes? Thanks, ...
4 14.06.2007 19:19:07
System.DirectoryServices.Protocols
I am experimenting with PowerShell code to undelete AD tombstoned objects. I can search, isolate and map an object to a particular deleted object. I need to use System.DirectoryServices.Protocols.DirectoryAttributeModification to perform the undelete. I am having a lot of trouble actually creating an object of this type. I have already loaded the relevant assembly and have successful...
4 14.06.2007 16:58:20
PS in a .NET app
So PS has TONS of power... is there a way i can harness that power in my ..NET applications? I know i can write scripts and what not with PS but its sort of hard to give it a nice interface (or rather, i guess thats what im asking how to do) I guess ideally what i would like to accomplish is creating a asp.net app that gets data from PS. what PS can do in one line is just amazing. i...
4 14.06.2007 16:42:06
get permissions from share via wmi possible
Hi, Is it possible to get permissions from a share via something like get-acl and then apply it to another share? I am migrating a server which has a lot of shares with various permissions. I started with: gwmi win32_share -computername prodfile01 |sort path thanks, ...
3 14.06.2007 16:03:01
Is it possible???
My boss just just gave me an assignment and I'm pretty sure PS can do it, but not sure of how to accomplish this without taking a class in it. He needs a list of user first and last names from AD and the email addresses that go with it. All of the properties that we need to get are on the general page. Can someone help? Thanks, Tom...
6 14.06.2007 12:13:01
Yet another person trying to remove Powershell 1.0
I am preparing to upgrade to Vista from XP Home SP2 and I have Powershell 1.0 installed. According to the upgrade advisor, as well as a few articles I've read, I won't be able to upgrade until I remove Powershell. I am trying to uninstall it and can't seem to make it happen. It's not in my Add/Remove Programs (even with 'Show Updates' checked). I do have a folder called 'C:\WINDOWS\$NtUnin...
2 14.06.2007 12:03:31
Get-ChildItem Path Limitation
I'm writing a powershell script that finds all of the files owned by a specific user in a specific path (local or remote) by using the following command: $FileList = dir $Path -r -Force | ? {(!$_.PSIsContainer) -and ($(GetFileOwner $_.FullName) -eq "$SID")} (GetFileOwner is a local function, because Get-ACL doesn't have an option of LogicalPath) While running the command, I get th...
2 14.06.2007 00:59:19
-f Format Operator
I am a beginner, thus it's difficult to make many contributions amongst such alumni. It would probably only take a scripting expert 10 seconds to work out how the -f format operator works, but it took me 30 minutes and zillions of failures before I finally grasped how it aligns columns. Just in-case there are any other newbies reading this forum I have a link to an article that I wro...
8 13.06.2007 18:15:11
execution policy - how does it work?
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C7ADC2.F5C04E30 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi One of my PS scripts is saved onto a network drive on one PC, and on = another PC, I've run Set-ExecutionPolicy RemoteSigned, mapped the same = share to the same drive letter, then run cd u: ..\pr.p...
3 13.06.2007 14:55:39
remove spaces from end of string
Hi, What is the best way to remove spaces from the end of a string, ie. $string = "abcdef 123 " I want to trim the string to be "abcdef 123" thanks, ...
3 13.06.2007 12:26:43
22 Pages: 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net