|
can someone explain what copyto() is doing?
Whenever I use copyto() on a filesystem object, it copies the file to my
home directory (c:\users\james) instead of to the directory I'm, is that
supposed to happen and why would they do that? Also if I use a relative
path I get a "partial path not found" error..
...
|
7 |
12/22/2008 5:45:52 AM |
|
Help us decide what to PowerShell tool to release next.
Taking an app from an internal application to a shrink-wrap ready for
the masses state is a lot of work, and updating/supporting/marketting
a product even more so. So after the huge sucess of PowerShell Plus
which is now safe in Idera's hands we need your help to decide what we
are going to release next. We plan to release some free projects, even
some opensource apps, but will likely look at...
|
2 |
12/21/2008 5:19:34 PM |
|
Get-Exchangeserver not Piping
Was trying to do something as simple as:
get-exchangeserver | get-EventLogLevel -server $_.name
but it didn't works, returning
Get-EventLogLevel : Cannot bind argument to parameter 'Server' because
it is null.
At line:1 char:49
+ get-exchangeserver | get-EventLogLevel -server <<<< $_.name
solved by
get-exchangeserver | ForEach-Object { get-EventLogLevel -server
$_....
|
2 |
12/21/2008 7:36:54 AM |
|
System.Int64 WorkingSet {get;}
The abovementioned is one of the definitions found in
System.Environment class.
See the following PS code:
[CODE]
PS R:\> [environment]::WorkingSet
12578816
[/CODE]
Q1. 'WorkingSet' is a static property in technical term. What is the
meaning of 'WorkingSet' in layman term?
Q2. The result shows '12578816', which I think it is in terms of
bytes, but what does it refer to?
cheers...
|
9 |
12/20/2008 11:27:43 PM |
|
bug in copy-item of readonly files
# this simple script illustrates a bug in copy-item involve -force and
readonly files.
# see comments below.
# cleanup from previous runs and setup for this one.
if (!(test-path c:\temp\t1 -pathtype container))
{
new-item c:\temp\t1 -itemtype container
}
else
{
remove-item c:\temp\t1\* -force -recurse
}
if (!(test-path c:\temp\t2 -pathtype container))
{
new-item c:\temp\t2 -...
|
1 |
12/20/2008 5:04:02 AM |
|
External command filename quoting
In a Powershell script I do this:
$myfile = "D:\Temp\MyFile.txt"
D:\Temp\MyApp.exe /file=`"$myfile`"
The command that is executed is as expected with the quotes around the
filename:
"D:\Temp\MyApp.exe" /file="D:\Temp\MyFile.txt"
However if the filename contains spaces and I execute the same command:
$myfile = "D:\Temp\My File.txt"
D:\Temp\MyApp.exe /file=`"$myfile`"
Powershell d...
|
9 |
12/20/2008 4:19:25 AM |
|
A Function question
Hi
I'm trying to create a function
function f([string]$a, [string]$b)
{
Write-Host "a:", $a, " b:", $b
}
f("a", "b")
but when I run the script the output is
a: a b b:
and not
a: a b: b
Can anyone help me with that, I can figure out what is wrong
Regards
Nie
...
|
4 |
12/19/2008 8:38:10 PM |
|
Trying to using osql
I have a batch file that runs a stored procedure against a database
using osql. I have gotten the osql command to work, but I can't figure
out how to determine if it fails. In my batch file I'm able to use IF
ERRORLEVEL, but in my powershell script nothing is being set. I have
tried $env:ERRORLEVEL, $LASTEXITCODE, and $?. The first 2 always
return blank, and $? always returns True.
D...
|
8 |
12/19/2008 8:37:56 PM |
|
Trying to sort then FT an array of HashTables.
I'd like to build an array of "objects" with properties I define, then
sort that array based on some of the properties, and finally format
the sorted results as a table.
I *thought* this would be super easy since HashTables' entries are
accessible using the key as a property.
This is an example of the solution I thought would be so easy:
PS> $a = @()
PS> $a+= @{FName="Kevin"; LN...
|
4 |
12/19/2008 6:06:02 PM |
|
CTP 3
Any news? ...
|
3 |
12/19/2008 4:26:01 PM |
|
Remove groups from users
I just moved all of my disabled users into one OU. I would like to move all
group membership from the users except the Users group. Is there a script to
perform this. I'm new to Powershell, but I'm really enjoying the power it
provides....
|
3 |
12/19/2008 4:22:10 PM |
|
Array indexing: Want to say "Item #2 through the rest of the array."
Let's say I have a text file called 'GetContentTest.txt' with the
number 1 through 10 in it with each number on its own line.
I'd like to skip over line 1 and just read lines 2 through 10. I know
that Get-Content does not have a parameter to start at line 2, but for
my purposes, I don't care 'cause this file will always be reasonably
small.
I *thought* I could do something like this:
P...
|
5 |
12/19/2008 3:35:31 PM |
|
Errors while run DTM Test USB Address Description Test
Hello,
I got some errors while run USB address description test.
These are the logs of some of these errors
Case 1
TaskResult Error
Root Cause
The Execute Task with Commandline
cmd /c IF FALSE == FALSE
(C:\WTT\JobsWorkingDir\Tasks\WTTJobRun902C0ADD-E1FB-4B12-AA36-4813B7A
C6D61\usbhct.exe -a -d 0DD4/0175 -l usbhct_a.log ) ELSE ( wttcmd /ping
/target: DTM_W2K3_SRV )
Failed with ExitCode 1
Resoluti...
|
2 |
12/19/2008 1:34:14 PM |
|
Using Powershell to change the group names in bulk
Hi,
Shay Levy assisted me on powergui forums in regards to my request for
changing the group names in bulk. I ran several tests in my QA environment
and was successful, however in production environment half way thru into
renaming, my process/cmdlets bogged down with this "DN" related error, I do
realize that is QAD cmdlets and I do have a question posted on their forum
but this erro...
|
1 |
12/19/2008 3:10:01 AM |
|
multiple listings in classes
Hi, my coworker and I have the exact same make and model PC, bought in the
same batch, and both run XP SP3. When I go into the processor class on my
PC, I get one listing of properties. When I go into the processor class on
my coworker's PC, I get two listings of properties, one with deviceid=CPU0,
and a second one identical except with deviceid=CPU1 and loadpercentage=0.
This PC only...
|
7 |
12/18/2008 8:50:05 PM |
|
Send email to multiple adresses
Hi all,
Does anyone knows how to send an email to multiple adresses via
Powershell.
I have tried writing two different adresses in $emailto but doesn't
work.
$emailFrom = "myadress@mydomain.com"
$emailTo = "myadress@mydomain.com" , "myadress2@mydomain.com"
$subject = "my subject"
$body = my body
$smtpServer = "smtp.mydomain.com"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
...
|
4 |
12/18/2008 3:09:08 PM |
|
How do you run a One-Click application from PowerShell
Every day a user runs this application manually.
Basically, only because I can't figure out how to schedule it.
The application is written in VB.NET and deployed to a server as a
OneClick application.
The main procedure looks for a filename argument and if none is found
it presents an Open Dialog for a user to select a file to process. I
can find the proper file with PowerShell so no user...
|
7 |
12/18/2008 2:45:54 PM |
|
Help to get PowerShell to add/edit/delete IIS Manager Users IIS7/2
I'm banging my head against the wall on this one...and hoping someone here
can assist! :)
I need to be able to add/edit/delete IIS Manager Users in IIS7 under Server
2008. I know that I need to use Microsoft.Web.Management and more
specifically ManagementAuthentication.CreateUser, SetPassword, DeleteUser and
such...
My problem is that I'm not sure how to invoke the right namespace/as...
|
6 |
12/18/2008 2:33:09 PM |
|
Getting the ACTUAL physical cpu socket, NOT LOGICAL
gwmi Win32_ComputerSystem -computer XXX | select NumberOfProcessors,
NumberOfLogicalProcessors
The results are inconsistent across different machines, may i know why ?
...
|
3 |
12/18/2008 10:32:42 AM |
|
Sort an array of numbers in Powershell
Does anyone know a way to sort an array of numbers in Powershell?...
|
6 |
12/17/2008 11:11:00 PM |
|
setting "Managed By" for groups in AD
Ok, I have been searching for a solution for weeks on this problem and am at
my end. I can affectively set the “Managed By†tab in AD, but cannot find
the way to properly set the “Write Members –Allow†ACE for the group. I can
change “Write Properties – Allow†or “Generic Write – Allowâ€, but that gives
too much access. How can I set JUST “Write-Members – Allowâ...
|
7 |
12/17/2008 11:01:02 PM |
|
Getting Active Directory attribute meta data (LastOriginatingChangeTime)
I'm working on a script where I need to compare the last time the member
attribute of a distribution group was modified (not the AD group object
itself) with the time stamp on a file (I'm exporting distribution group
memberships to a file, but only ones that have changed). The problem
I'm running into is that some Active Directory distribution groups
aren't returning the member attribut...
|
3 |
12/17/2008 8:32:06 PM |
|
What does "$this" refer to?
When I do a get-member on a get-process object, I see the following:
Path ScriptProperty System.Object Path
{get=$this.Mainmodule.FileName;}
However, path never returns the path, it returns nothing when I try to echo
it, is there a special way to use it? and what does the "$this" refer to in
"$this.mainmodule.filename"? Thanks.
...
|
5 |
12/17/2008 5:47:47 PM |
|
PS Scripting Issue
Hi All,
I am currently working on a script to query active directory for user
information and I arrived at this script:
Get-QADUser -SearchRoot
'mydomain.com./UNI_HQ' -DontUseDefaultIncludedProperties -IncludedProperties
'department','Title', 'mail', 'telephoneNumber',
homeDirectory | Format-Table name, 'department',
'Title','mail','telephoneNumber'
I output the results to a fil...
|
4 |
12/17/2008 2:40:25 PM |
|
Date and time
Hi all,
I just want to run my script during 3 hours every day.Let's say 20,21
and 22.
The script before to start with the first process has to check the
hour and if it's ok (20,21,22) continue with the next processes.
What I have done is to get the hour using ($timeok = (get-date).hour
| out-file time.txt )
The script if the time is "not ok" has to sleep 15 min and check the
time ...
|
5 |
12/17/2008 2:01:21 PM |