|
Using the $_ pipeline with WMI
Newbie here...
I am trying to develop a list of software that needs to be uninstalled
on a computer.
I have the output list :
IdentifyingNumber name vendor
----------------- ---- ------
{01A4AEDE-F219-49A2-B855-16A016EAF9A4} Intel(R) PROSet II Intel
and am trying to iterate through the list and get-wmiobject for eac...
|
3 |
27.04.2007 14:27:03 |
|
Need to customize shell view for existing mount point
Hello,
I have an existing mount point that I would like to customize the right
hand pane shell view in Windows Explorer. Specifically, I would like to
add my own custom columns to this view. Is there a way to do this
without developing a full-blown namespace extension?
Thanks,
Brad...
|
2 |
27.04.2007 13:22:27 |
|
subtraction problem
my first script doesent work
$a = (get-wmiobject win32_logicaldisk -filter "name='d:'").size
$b = (get-wmiobject win32_logicaldisk -filter "name='d:'").freespace
$c = $a - $b
write-host $a
write-host $b
write-host $c
error:
The operation '[System.UInt64] - [System.UInt64]' is not defined.
At line:1 char:10
+ $c = $a - <<<< $b
what is the problem?...
|
5 |
27.04.2007 12:26:00 |
|
Type Extensions and parameters
A while ago I created a function that gave the total size of a directory
including all sub directories. I'm currently enjoying reading "Windows
Powershell in action" book by Bruce Payette, which introduced me to Type
Extensions. So I have created the Type Extension:
<Types>
<Type>
<Name>System.IO.DirectoryInfo</Name>
<Members>
...
|
3 |
27.04.2007 09:18:01 |
|
Copy|Move-ItemProperty: different meaning of -Name: why?
From help:
Copy-ItemProperty -name <string>
Move-ItemProperty -name <string[]>
It seems to me Copy and Move parameters should be as much similar as
possible. Variant with <string[]> looks more practically useful.
Any remarks?
--
Thanks,
Roman Kuzmin
...
|
3 |
27.04.2007 08:07:52 |
|
Get-wmiobject, permissions issue...
hello everyone! I am having a bit of an issue getting past the wmi
permissions using the following script. if i run as an admin it connects
just fine but if connect as a differnet user it gives me access denied
message *** Get-WmiObject : Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED)) ***
I have granted the user account full permission to control the service b...
|
6 |
26.04.2007 23:27:41 |
|
network drives
Hi there, i'm trying to list all network drives mapped on a computer on
powershell, by writing their letter, names, and paths (ie :
\\xxxx\xxxx\xxxx)
how could i do it ?
thx
Nico
...
|
3 |
26.04.2007 23:13:25 |
|
redirect write-host
How do I redirect the output of a script that uses write-host?
Ie I have a script Foo.ps1
write-host Hello
and I have tried
Foo > foo.log
Foo | tee foo.log
If I change the write-host to write-output, then I can redirect the output,
but then when I use the tee, the output does not appear on the console until
the script completes (I have a long running script and I want to see ...
|
13 |
26.04.2007 22:10:03 |
|
How take an user input in command line Options
I want to take user input from commandline and procees based on it
In windows XP I can do
set /p test=Enter 1 or 2
IF %test%==2 GOTO TWO
IF %test%==1 GOTO ONE
How can I do in WIndows CE 4.2 or CE 5.0. It doesn't recognize set /p
command
Any help is appreciated
...
|
2 |
26.04.2007 15:06:36 |
|
powershell user demographics
I'm curious, now that powershell has been out for some time, what the
demographics are..
Are there more powershellers with a Developer Bent, or a Admin Bent?
of those with an Admin Bent, are they classic GUI admins, with a
little commandline work for essentials, or do they have development or
scripting background.
Maybe some of you could share the answer to these questions for
yourselve...
|
5 |
26.04.2007 15:01:45 |
|
Not updating drive listing?
I'm tring to use TrueCrypt with powershell. TrueCrypt is an encryption
program which in my case is encrypting a whole drive/partition meaning
the drive lester only shows up after I run the program. I'm running it
inside powershell, but I can't seem to access the drive unless I restart
powershell. Get-PSDrive shows the drive (O:) but I can't access it. Is
there a way to get it to refres...
|
4 |
26.04.2007 14:12:20 |
|
Running External Application
I am trying to get powershell to read an OU in AD and install a
program on each computer in that OU...i have it where it will show all the
computers in the OU and "connect" to them but the application gets executed
on all of them at once and doesnt work...i need to figure out how to stager
it i guess.
Maybe get it to where it runs on one and completes and then the next and
completes a...
|
6 |
25.04.2007 21:53:18 |
|
Where does the 'out' verb come from?
VC# Express is telling me:
Error 1 'System.Management.Automation.VerbsCommon' does not contain a
definition for 'Out' C:\Visual Studio
2005\Projects\MyOvoSnapIn\MyOvoSnapIn\OutOpcMsg.cs 10 25 MyOvoSnapIn
I have the following C# section in my cmdlet:
[Cmdlet(VerbsCommon.Out, "OpcMsg")]
public class OutOpcMsg : PSCmdlet
What might I be missing here?
There are definitely out- cmdl...
|
2 |
25.04.2007 17:28:44 |
|
simple questions
This is a multi-part message in MIME format.
------=_NextPart_000_0006_01C7869E.42FA4080
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello Team,
can someone help in achieving=20
dir /p and start . in powershell
Thanks,
Preetam
------=_NextPart_000_0006_01C7869E.42FA4080
Content-Type: text/html;
charset="iso-8859-1"
Content-Tra...
|
6 |
25.04.2007 16:58:40 |
|
Constructor definition
How would I get construction definition for the assemblies loaded by
[Reflection.Assembly]::LoadFrom()
I can use Type.GetConstructors method to get the all the constructors but
how do I find out about the parameter definition?
...
|
2 |
25.04.2007 16:16:04 |
|
clr the editor?
Hmmm? clr not supported?
Also discovered a bug when entering...
c:\>cmd clr
Leaves the PowerShell open but no commands will run. The exit command has to
be submitted twice.
...
|
5 |
24.04.2007 23:04:00 |
|
Accessing Firewall settings from WMI
Is there a way to read the various firewall exceptions
(program/port/protocol) via WMI?
--
Keith
...
|
7 |
24.04.2007 19:31:24 |
|
How to disable filename globbing?
Hi:
I have a simple PowerShell function where I want to pass a string as an
argument to a program that's being executed. Here's my function:
function hgrep {
compgrep --include="*.h" $args
}
My problem is that the string seems to be interpreted as a regular
expression, or a wildcard for filename globbing. Is there a way that I can
just pass the string "*.h" to a program?...
|
8 |
24.04.2007 19:24:11 |
|
Network Error Statistics
Hello All,
I would like to use powsershell and wmi to derive the same information as:
netstat -ps IP
Any ideas or suggestions?
Ultimately I am interested in determining the network error statistics
from the PC. For example: I would like to collect CRC, runts, giants
etc.
Thanks in Advance
...
|
11 |
24.04.2007 19:10:03 |
|
sum all .length not giving the same result as windows explorer ??
I've created this little script.
when I run it on my C:\ it does not show the same result as windows explorer
!!
(ps result is 9.4Gb and Windows explorer usage result is 14,3Gb)
#Get-FolderSize.ps1
# display full size (including subdirectories)
$TotLength = 0
$NoFiles = 0
$RootName = dir | select-object -First 1 -property Directory
dir -recurse | foreach-object { $TotLength+= $_.le...
|
6 |
24.04.2007 12:23:38 |
|
Invoking PowerShell functions with parameters from .NET: issues.
I have to invoke a PowerShell global function from C# code:
using (Pipeline p = ...CreatePipeline())
{
Command c = new Command("MyFunction");
c.Parameters.Add("Name1", ...);
c.Parameters.Add("Name2", ...);
p.Commands.Add(c);
Collection<PSObject> result = p.Invoke();
...
}
(Question: is this way OK?)
Let MyFunction is:
function MyFun...
|
1 |
23.04.2007 12:35:54 |
|
Info : "Console based intellisense" Tabcompletion for PowerShell
I released a new version of my PowerTab PowerShell tabcompletion extension,
http://thepowershellguy.com/blogs/posh/archive/2007/04/16/powershell-tabextension-part-5-powertab-0-9.aspx
with what I think a lot of new cool and usable functionality , amongst
others offering DoubleClick support, extensable output system and "Console
based intellisense" for PowerShell
Enjoy,
Greetings /\...
|
3 |
22.04.2007 22:05:07 |
|
Bug with multidimensional arrays
I don't know if this is a bug but I don't understand the behavior when adding
elements to a multidimensional array. I want to know the number of elements
in the array so that I can loop through it later. Here is an example where
every thing works fine until I add to the array.
PS C:\> $a = (1,2), ("a","b")
PS C:\> $a[0][1]
2
PS C:\> $a[1][1]
b
PS C:\> $a.length
2
PS C:\...
|
2 |
22.04.2007 19:24:03 |
|
Foreach loop over $NULL in Powershell
I've noticed that in powershell, if I run a foreach loop over a null valued
expression, the loop runs at least once. The following code illustrates this
issue
#--------------------#
$nullColl = $NULL
foreach($item in $nullColl){
"This is an item"
}
#--------------------#
which prints "This is an item" once.
Is this a feature or a bug of powershell? It seems to me that intuitively...
|
3 |
22.04.2007 08:00:02 |
|
WMI access is denied
Hello all,
I am just starting with powershell and am loving it.
I have written a few scripts that work on all machines in my network except
for five.
I keep getting wmi access denied. I have searched for answers on this but
have not found one.
Thanks for any help.
...
|
3 |
22.04.2007 06:26:00 |