|
regex global match like Perl m//g
How do I use PowerShell to find all matches of a regular expression in a
string, analogous to the 'g' option on matches in Perl?...
|
11 |
14.07.2007 00:14:38 |
|
Modify a text file
Hello,
I have a file text like this (about 6000 lines) :
text1
text2
text3
....
I'm looking to a PS solution to obtain this :
text1;text2;text3;...
textn;textn+1;...
The lines should not be longer than 255 chars;
The "text" should not be truncated.
Thanks
--
CGM
...
|
1 |
13.07.2007 22:52:03 |
|
script help
I would like to be able to move collection in sms 2003 via powershell
Plan
Find the collection id of the collection I want to move
Find the collection id of the collection I want to be the new parent
script
Connect to the "SMS_CollectToSubCollect" class
$c = Get-WmiObject -class "SMS_CollectToSubCollect" -namespace
"root\SMS\site_c01" -computerName "sms-srv" |
Where-Object { $_.parentCo...
|
1 |
13.07.2007 22:18:00 |
|
Considering moving from bash...
I develop .Net apps on Windows but come from the Linux world and have
installed cygwin on my machine and am too lazy to learn Powershell
(let's be brutally honest).
That said, if someone could lemme know what the Powershell equivalent
of the following commands I would switch over and begin using it. But
I am under a major push right now and having to look through the
documentation is daun...
|
6 |
13.07.2007 22:04:56 |
|
PS in notepad2 ?
Did you find some method for integrating PS syntax/autocompletion into
notepad2 ?
Thx
Nico
...
|
1 |
13.07.2007 21:48:43 |
|
Regular expression notes
I've run into several gotchas using regular expressions in PowerShell. After
getting past some roadblocks (thanks in part to help given here) I wrote up
some notes in case other people have similar questions, especially those
coming from Perl.
http://odin.mdacc.tmc.edu/~cook/regex.html
...
|
3 |
13.07.2007 21:10:09 |
|
What editor to use on cmdlets?
I am used to working linux and typing
vi filename
When in msh what do other use to edit? Do you stay in the msh and
type
edit filename
and use dos edit
maybe people use notepad or notepad++
Just trying to get some idea to help me out.
...
|
4 |
13.07.2007 21:03:54 |
|
Telnet and PowerShell
I am trying to automate a process through powershell to connect via telnet
port to a cisco switch or router. After I do so, log in, have it copy the
running config to a tftp server and disconnect.
I know how to do the steps manually but i would like to automate this as i
have a large number of switches and routers that I want to capture both the
running and startup configs.
I have f...
|
5 |
13.07.2007 21:02:37 |
|
ADSI and group membership - what am I doing wrong
I'm trying to commit changes to group membership but nothing seems to happen
#>[adsi]$grp = get-adobject -class Group -filter "(name=myGrp)"
#>[adsi]$usr = get-adobject -class User -filter "(name=myUser)"
#>$grp.member.add([string]$usr.distinguishedname)
## - $grp.member will show the dn of the user is showing at this point
## - now I try to save the changes - I can't find a SetI...
|
5 |
13.07.2007 20:58:48 |
|
How to learn scripting/programming constructs
This is a multi-part message in MIME format.
------=_NextPart_000_0018_01C7C52F.08E3F380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Reading through PowerShell in Action has made me acutely aware of just =
how ignorant of ...I don't even know what, just ignorant when it comes =
to effective problem solving constructs. I wish I knew how to...
|
5 |
13.07.2007 20:05:22 |
|
why my script not working ?
When i run my script in the cmd prompt, it gives the following error :
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x80070
6BA)
At D:\PowerShell\scripts\kb.ps1:11 char:16
+ $checkkb = gwmi <<<< Win32_QuickFixEngineering -computer $computer |
where {
$_.hotfixid -eq $kb} | select-object hotfixid
===============================================...
|
7 |
13.07.2007 19:42:25 |
|
Native command redirection in Monad (MSH)
How do I redirect the output from the call of a native command to my own
PSHost application? I'm able to recieve the output from cmdlets but when
calling a native command like tf.exe a new window is spawned and the output
is not redirected. The
NotifyBeginApplication() method is being called in my host application, but
there are no parameters for me to hook onto the newly spawned proce...
|
2 |
13.07.2007 19:00:00 |
|
Vim and PowerShell paths
No doubt the PowerShell folks will think this is a Vim question, and the
Vim folks will think this is a PowerShell question.
When I try to edit a file with Vim 7.1 from Windows PowerShell, Vim
seems to require a full path to the file. For instance, if I'm in "H:\My
Documents\WindowsPowerShell" and I type "vim profile.ps1" or even "vim
..\profile.ps1" I find myself editing "H:\profile.ps...
|
6 |
13.07.2007 17:59:53 |
|
How export-csv deals with string versus string[]
An interesting question came up regarding Exchange 2007. One of the
cmdlets returns properties that are a simply system.string, while some
other properties are system.string[].
[PS] C:\Documents and
Settings\Administrator>Get-MessageTrackingLog|select-object
recipients|export-csv c:\test.csv
[PS] C:\Documents and Settings\Administrator>gc c:\test.csv
#TYPE System.Management.Aut...
|
3 |
13.07.2007 17:18:53 |
|
Restore DB2 Database with PowerShell
Any and all PowerShell users that also use DB2 - I've written a script
to make the task of restoring a database (restoring a production DB
backup into a test DB) and posted it to the DB2 Express-C forum:
http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=805&thread=168815&cat=19
I'm interested in hearing how the script could be improved - I don't
claim to be a PS expert, I jus...
|
1 |
13.07.2007 15:07:57 |
|
PowerShell access to AD user Terminal Services attributes
I've been looking at using PowerShell to help me manage my users in Active
Directory and so far I like everything that I am seeing. I have ran into an
issue though where I can not figure out how to access the users' Terminal
Services attributes.
Here is the command I am using to get the user information from Active
Directory:
Code Snippet
Get-WMIObject -class ds_user -n...
|
3 |
13.07.2007 13:05:52 |
|
Powergadgets MVP ?
Hello, i've tried to request a free copy of PowerGadgets, by filling the
form, but the only thing i didn't fill was my phone number, and no answer
has been given to me :'(
Could someone send me a MVP serial number please ?
Bye
Nico (nicopilami at gmail dot com)
...
|
8 |
13.07.2007 12:12:33 |
|
Active Directory Provider - from microsoft
Is microsoft coming out its own AD provider ?
Does anyone know when is the next version of powershell coming ?
...
|
2 |
13.07.2007 12:07:17 |
|
Limited properties with user objects using Get-QADUser
Hi!
I would need to create list of my users and I was planning to do it with
Get-QADUser cmdlet. Unfortunately it seems that these objects have limited
amount of properties so I can't select Division as one of the properties for
my table (get-qaduser | select-object Name,LogonName,Company,division).
Is there any way to query for the division information on each object in the
pipeline...
|
7 |
13.07.2007 11:36:01 |
|
get-content driving up powershell.exe mem usage
I'm not sure if this is a bug or not (sure does seem like it), but i have a
10mb file I threw at get-content and it never actually gets the content and
just sits there. Good thing i checked task manager because it went from
taking 78mb of memory to 1.5gb and was still growing. It seems to only go
this route with relatively large files (10mb+). Small text files work just
fine. All I d...
|
8 |
13.07.2007 09:17:35 |
|
Active Directory provider
how can i get one, and add one ?
...
|
6 |
13.07.2007 05:05:35 |
|
Recursively delete files with filter on subdirectories
I am trying to achieve a small cmdlet.
<Root>
<Dir1>
<Dir11>
- file1.txt
- file2.log
<Dir12>
<Dir2>
<Dir21>
- file3.txt
- file4.log
- file5.ini
<Dir211>
file6.txt
Lets say I want to remove all files except extn *.log from <RootDir>
excluding any file...
|
12 |
13.07.2007 02:53:21 |
|
equivalent of on error resume next
What is the powershell of "on error resume next"
What are the error cmdlets i can note of ?
...
|
2 |
13.07.2007 02:49:04 |
|
parsing csv files with fields that may contain commas
Hi,
What is the best way to parse a csv comma delimeted file which may have
commas in the fields. If there are commas in the field, it is enclosed in
double quotes, ie.
field1,field2,field3
"field1, abc",field2,field3
So, in the second row, the first field would be: "field1, abc"
Thanks in advance,
...
|
7 |
13.07.2007 02:18:02 |
|
Set a new file owner
My forehead is bruised from trying to come up with simple code to set a
new owner for a file. Something like this should work
$file=".\file.txt"
[System.Security.Principal.NTAccount]$newOwner="mydomain\roygbiv"
$var=get-item $file
$acl=$var.GetAccessControl()
$acl.SetOwner($NewOwner)
$var.SetAccessControl($acl)
But I always get: Exception calling "SetAccessControl" with "1"
argument(...
|
8 |
12.07.2007 22:52:04 |