|
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 |
6/16/2007 4:39:01 PM |
|
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 |
6/16/2007 8:50:47 AM |
|
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 |
6/16/2007 1:38:36 AM |
|
Accessing Metadata
Is there a way to access file metadata?
For example the extended information tagged with photos, mp3s etc.
Thanks.
Brian...
|
4 |
6/15/2007 9:31:07 PM |
|
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 |
6/15/2007 3:52:01 PM |
|
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 |
6/15/2007 7:11:41 AM |
|
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 |
6/15/2007 5:26:04 AM |
|
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 |
6/15/2007 2:22:42 AM |
|
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 |
6/15/2007 2:01:48 AM |
|
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 |
6/14/2007 9:25:02 PM |
|
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 |
6/14/2007 8:04:32 PM |
|
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 |
6/14/2007 7:19:07 PM |
|
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 |
6/14/2007 4:58:20 PM |
|
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 |
6/14/2007 4:42:06 PM |
|
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 |
6/14/2007 4:03:01 PM |
|
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 |
6/14/2007 12:13:01 PM |
|
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 |
6/14/2007 12:03:31 PM |
|
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 |
6/14/2007 12:59:19 AM |
|
-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 |
6/13/2007 6:15:11 PM |
|
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 |
6/13/2007 2:55:39 PM |
|
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 |
6/13/2007 12:26:43 PM |
|
Reading Zip, GZip
I have found the Community Extensions to create zip and gzip files but I can not find anything to
read or extract files from an archive.
I have a large set of gz files that I need to expand to a new location, does anyone know of any
other scripts out there that I may have missed?
I did start looking at System.IO.Compression, but could not get anything to work in PS.
Many Thanks
Rob...
|
7 |
6/13/2007 7:29:24 AM |
|
Whatever happened to...
....WMI support for IE7 on Vista? It's there on XP, but on Vista I get
an invalid class notification if I try this:
gwmi -namespace "root/cimv2/applications/MicrosoftIE" -list
Cheers,
Rick...
|
2 |
6/13/2007 6:01:19 AM |
|
supplying help option and throwing on empty option
Just wanted to poll the collective brain on the best way to go about this . . .
I have a script which takes a number of options at run-time (of which
defaults are stored in 'param'). One of the options is -help which
gives the user a nice help description. However, one of the options
should throw an error if left blank. But if the user issues -help and
the required option is blank then,...
|
4 |
6/12/2007 2:24:06 PM |
|
Equivalent to $0?
How does one capture the name of the script one is in with PS? In ksh this
would be $0. But I can't seem to find the equivalent here.
--
Charlie.
...
|
11 |
6/12/2007 5:51:13 AM |