|
|
Uninstalling PowerShell in Vista Home to upgrade to Vista Ultimate
I have Vista Home on a Dell studio laptop. I have just reinstalled this after
a HD replacement. I am trying to upgrade to Vista Ultimate. A Compatibility
check during the start of the upgrade says to uninstall Windows PowerShell. I
went to the microsoft support site for guidance. I am unable to see
PowerShell or its KB in the list of installed updates as the guidance said I
should see. Hence, I am unable to select it to uninstall. The list of
installed updates only says "Update for Microsoft Windows" or "Hotfix for
Microsoft Windows." How can I get it to show PowerShell? A search
|
7/2/2010 10:37:34 PM
|
0
|
=?Utf-8?B?U3BhY2VmYXJlcg==?= <Spacefa...@discussions.microsoft.com>
|
Create Site Link
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01CB1A1D.BCC768F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am trying to create a Site Link Object on a server core machine using =
new-adobject cmdlet, however the below syntax fails. Pls assist
new-adobject -name "US-AU" -type siteLink -Path "CN=3DIP,CN=3DInter-Site =
Transports,CN=3DSites,CN=3DConfiguration,DC=3Dcausal,DC=3Dcom"
The error message is like below
New-ADObject : A required attribute is missing
At line:1 char:13
+ new-adobject <<<< -name
|
7/2/2010 2:05:33 PM
|
0
|
"Venkat" <Ven...@live.com>
|
Nice seeing all of you hopefully I see you in the other forum
really I just wanted to get the last post in prior to it closing today :)
|
7/2/2010 12:58:42 AM
|
0
|
=?Utf-8?B?Qm9iIExhbmRhdQ==?= <BobLan...@discussions.microsoft.com>
|
File size limit when using Move-item cmdlet?
Greetings all,
Quick question. Is there a file size limitation when using the Move-item
cmdlet? Given the example below, it works great for smaller files (approx 7
MB) but not for larger files (approx 8 GB).
There exists 3 files in the $SRC_DIR.
MHSPHP_0326.bak (approx 7 MB)
PRJ_PHINFO_LT_0628.bak (approx 8 GB) PRJ_PHINFO_LT_backup_201006301100.bak
(approx 8 GB)
Issuing the following commands in Powershell 1.0
PS C:\> $SRC_DIR = "D:\DB Backups\AQDEV\PRJ_PHINFO_LT"
PS C:\> $DEST_DIR = "\\windcsrv\Backup\dbarchives\PRJ_PHINFO_LT"
PS C:\> Get-Childitem $SRC_DIR -recurse
|
7/1/2010 3:02:24 PM
|
1
|
=?Utf-8?B?TG9vcHNsdWRnZQ==?= <Loopslu...@discussions.microsoft.com>
|
Powershell Timespan and While Loop
Can you use the timespan feature to limit the amount of time that a given task will attempt to execute? I'm attempting to do a system audit, but a lot of the servers are behind firewalls and do not respond, thus I must wait for them to time out. What I'd like to do is say continue to try to contact the server until 10 seconds has passed, and then skip to the next server in the list.
Could I use something like this in my system audit?
$timespan = new-timespan -seconds 10
while ($timespan -ne 10)
{
Code
}
|
7/1/2010 2:11:04 PM
|
1
|
SeanT <u...@msgroups.net/>
|
PowerShell can't find module in batch file
Warning: NOOB here -
On Windows 2008 R2, When running my custom software's installation program,
I run a batch file to execute PowerShell to enable Dot Net 351.
This batch file contains 1 command:
powershell.exe -NoExit Import-Module ServerManager ; Add-WindowsFeature
as-net-framework
The batch file executes but fails, with the following errors:
C:\Users\Administrator\Desktop>powershell.exe -NoExit Import-Module
ServerManager ; Add-WindowsFeature as-net-framework
Import-Module : The specified module 'ServerManager' was not loaded because
no valid module file was found in
|
7/1/2010 2:04:47 PM
|
0
|
=?Utf-8?B?Z3JlZ3A=?= <gr...@discussions.microsoft.com>
|
|
|
Setting an executables privilege level in PS
Hi
I need to set the option "Run this program as an administrator" on
Server 2008 R2 for a number of executables. The option is required for
UAC to step in when an user starts the executable and can be set on
the compatibily tab of a files properties' dialog.
Any ideas someone on how to do it with PS ?
Thanks in advance,
Markus
|
7/1/2010 1:58:33 PM
|
0
|
Markus Zywitza <markus.zywi...@gmail.com>
|
server.ConnectionContext.ExecuteWithResults issue
I am using this function to perform adhoc queries against the database. I am
processing the results in in a foreach loop accessing the results through the
$results.Tables[0].Rows element of the result set. The issue that I have is
that the first result returned in the loop includes the column header. I
believe that I need to pipe the results toaselect statement that filters out
the header, but I have not been able to locate documentation on the available
filters. Any help would be appreciated.
|
6/30/2010 11:05:44 PM
|
1
|
=?Utf-8?B?a3BtY2dpbm4=?= <kpmcg...@discussions.microsoft.com>
|
Retain formating from outlook email into word document?
As you can obviously tell from the script, I don't do this for a living.
The script takes the contents of an existing email in outlook, removes some
stuff from the header and then writes it to a new MS Word document. It is
working.
The next step is to get it to preserve the HTML formatting of the original
email message.
I tried Changing "$messagebody = $m.body" and
"$selection.TypeText($wordcontent[1])" to "$messagebody = $m.htmlbody" and
$selection.TypeText($messagebody)" but it didn't work.
So I'm pretty much out of ideas about how to retain the html formatting whe
|
6/30/2010 10:09:10 PM
|
0
|
=?Utf-8?B?YnJ1ZGdlcnM=?= <brudg...@discussions.microsoft.com>
|
PowerShell script timing out restoring SQL 2008 database from back
I have written a PowerShell script that restores a MS SQL 2008 Enterprise
database from a backup. This backup was made using another PowerShell script.
The problem comes in with the actual restore command, it is started and
exactly 10min after starting the command fails. There is nothing in the SQL
logs to indicate what the problem could be. The error reported by PowerShell
is (sensitive details removed):
Exception calling "SqlRestore" with "1" argument(s): "Restore failed for
Server 'xxxxxxxxx'. "
At D:\transport_actions\powershell\AS.PS.Restore.Report.Server.ps1:92 char:23
+
|
6/30/2010 4:35:13 PM
|
1
|
=?Utf-8?B?bWFhcnRpbg==?= <maar...@discussions.microsoft.com>
|
powerShell error with Events and ref Arguments
This sample Script brings powerShell to crash because of the ref Argument in
the C# event.
Does anybody have an idea how to solve the problem, when passing Events with
ref arguments to a powerShell script. I just want to ask a script from a C#
assemblie to get some values and not only one return value.
#Add new Class Type
Add-Type -TypeDefinition @'
public class TestClass
{
public delegate void SetupEventHandler(ref int value);
// public delegate void SetupEventHandler(int value);
public event SetupEventHandler Setup;
public void fire
|
6/30/2010 8:18:54 AM
|
1
|
=?Utf-8?B?Sm9jaGVuIEF4dA==?= <Jochen...@discussions.microsoft.com>
|
searching for values not in this range.
I've this array of alaphets.
Eg {"a", "d", "k")
I want to search for values NOT in the above range, what is the syntax like
?
|
6/30/2010 4:24:44 AM
|
3
|
"IT STAFF" <jkk...@hotmail.com>
|
Comparing objects
Hello,
I don't know if it's the right process, but I would output any names which
are not found in a text file, but was found in Active Directory.
The text file is using this format:
samaccountname:givenname:name
user123:USER:USERR
I'm using this commands:
compare-object -includeEqual (get-aduser -filter * | ft samaccountname)
(import-csv -path c:\comptes.txt -delim ":" | ft samaccountname) -prop
samaccountname
I don't understand what is returned. Is anybody know if I follow the right
way?
Thanks
|
6/29/2010 4:16:05 PM
|
1
|
"Jean-Luc" <j...@lan-explore.fr>
|
Detect 2.0 scripts when running on 1.0
I need to write up a C# console app that would take in a PowerShell script
passed to it and execute it. I've got it mostly running by using the
System.Management.Automation namespace and the corresponding 1.0 reference
library. However, I'm running into an issue where the script can contain
commands meant for PowerShell 2.0 (e.g. ThreadOptions). In this case, the
script fails even if the script has a check in place for the powershell
version. For example:
$ver = $host | select version
if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}
fails right a
|
6/29/2010 6:53:58 AM
|
1
|
=?Utf-8?B?c25vb2tz?= <sno...@discussions.microsoft.com>
|
Server Local Group Auditing Question
This script is modified from web to perform auditing of local server groups
and their members. Since I have to do this on a large number of servers I
would like the results written to a Access Database instead of on large text
file. Since I am fairly new to powershell and scripting I dont know how to
do this. Any assistance would be greatly appreciated.
########################
#Functions
########################
$arrExclude = "NT AUTHORITY\LocalService",
"NT AUTHORITY\Local Service",
"NT AUTHORITY\NETWORK SERVICE",
"NT AUTHORITY\Networ
|
6/28/2010 3:05:40 PM
|
1
|
=?Utf-8?B?VGltIERpeG9u?= <TimDi...@discussions.microsoft.com>
|
Script Repository
I just now started browsing the Script Repository.
(As usual I'm behind the curve a little.)
http://gallery.technet.microsoft.com/ScriptCenter/en-us/site/search?f[0].Type=ScriptLanguage&f[0].Value=Powershell&f[0].Text=Windows%20PowerShell
If I can't match my contribution to an existing category,
what should I do? I'm anticipating uploading my version
of the Start-Demo function.
It assists doing PowerShell demos and is a derivation from
these prior versions
#
# Jeffrey Snover
#
http://blogs.msdn.com/b/powershell/archive/2007/03/03/start-demo-help-doing-demos-using-powershell
|
6/27/2010 7:05:27 PM
|
1
|
Larry__Weiss <...@airmail.net>
|
help about_break
A part of the output of
help about_break
is
You break out of the other looping statements in the same
way you break out of the Foreach loop. In the following
example, the Break statement exits a While statement when
a DivideByZeroException exception is trapped using the
Trap statement.
$i = 3
while ($true)
{
trap [DivideByZeroException]
{
Write-Host "divide by zero trapped"
break
}
1 / $i--
}
I don't think this is strictly true. Doesn't the break within
that trap
|
6/27/2010 4:52:07 AM
|
7
|
Larry__Weiss <...@airmail.net>
|
Microsoft PowerShell websites
I consider these as the primary (portal) Microsoft maintained PowerShell
websites:
Microsoft's Windows PowerShell webpage
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx
Microsoft's MSDN PowerShell webpage
http://msdn.microsoft.com/en-us/library/dd835506(v=VS.85).aspx
Microsoft's TechNet PowerShell webpage
http://technet.microsoft.com/en-us/library/bb978526.aspx
Are there other Microsoft PowerShell websites that
I should add to that list?
- Larry
|
6/26/2010 3:01:03 PM
|
3
|
Larry__Weiss <...@airmail.net>
|
Windows PowerShell Time out question
Wondering if there's a way to limit how long PowerShell will try to get the
following information out of a servers WMI. Here's what I've got currently,
it works fine so long the servers respond...
$a = New-Object -comobject Excel.Application
$a.visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "Domain"
$c.Cells.Item(1,2) = "Server Name"
$c.Cells.Item(1,3) = "Operating System"
$c.Cells.Item(1,4) = "IP Address"
$c.Cells.Item(1,5) = "Service Packs"
$c.Cells.Item(1,6) = "System Type"
$c.Cells.Item(1,7) = "Manufacturer"
$c.Cells.Item(1,8)
|
6/25/2010 8:42:20 PM
|
1
|
=?Utf-8?B?U2VhbiBULg==?= <Sean T.@discussions.microsoft.com>
|
empty subexpression
No big deal, more out of curiosity: anyone an idea what makes the last
output different from the other two?
PS> "a$($null)a"
aa
PS> "a$( )a"
aa
PS> "a$()a"
a$a
PS>
|
6/25/2010 8:10:34 PM
|
1
|
"Hans Dingemans" <hansdingem...@hotmail.com>
|
comparing lastLogonTimestamp
This question is less about the problem at hand and more about how to deal
with the issue of changing types in powershell.
I need to find all the accounts in an OU created more than 30 days ago that
have Never been logged into or haven't been logged into for 60 days. I have
this snippet that uses the quest cmdlet:
Get-QADuser -searchroot "corp.net/user accounts/users/OurOU" |
where { ($_.whencreated -lt ((get-date).adddays(-30)) ) -and
( ( $_.lastLogonTimestamp -like "Never") -or
($_.lastLogonTimestamp -lt ((get-date).adddays(-60))
)
|
6/25/2010 7:13:49 PM
|
3
|
"Martin, Greg \(RTIS\)" <Gmar...@reedtech.com>
|
why defaultnamingcontext not working ?
## determine the LDAP search path ##
$obj=[ADSI]"LDAP://ROOTDSE"
$mysearch = $obj.defaultNamingContext
get-qaduser -searchroot $mysearch ==> not working
but
get-qaduser -searchroot 'DC=etc,DC=microsoft,DC=com' ==> working
Do i need to list it out openly ?
|
6/25/2010 4:43:21 AM
|
1
|
"IT STAFF" <jkk...@hotmail.com>
|
search specified applications
I want a script that will search a list of machines for specific
applications (such as 'Microsoft Office). This script will list all
applications installed. Is there a way to apply a filter or condition
to find specified applications instlled on the machines?
$Catalog = "C:\scripts\machinelist.txt"
$CatalogList = Get-Content $Catalog
foreach ($Machine in $CatalogList)
{
write-host "Connecting to $Machine..."
$colItems = get-wmiobject -class "Win32_Product" -namespace
"root\CIMV2" -computername $Machine
foreach ($objItem in $colItems)
{
write-host "Instal
|
6/23/2010 6:30:11 AM
|
4
|
James <jwand...@lycos.com>
|
Error: $customObject | format-table
I see this problem all over but have tried every proposed solution but
nothing provided works for me. Bottom line, I am creating a custom object
via .csv import but when trying to format-(to anything), I get the error
shown below the script. Sorry if this is a dead-horse. BTW...using v2 on
W2K8R2. Everything works except the last line. If the "ft" is not there,
the results are listed in "format-list" by default...but I want a table
format. (Script below is word-wrapped of course".
###Beginning of script
param([SWITCH]$help, [STRING]$ouDN, [STRING]$file)
#############
|
6/23/2010 3:17:04 AM
|
1
|
=?Utf-8?B?UGF1bCBCLiAoVVNBRik=?= <PaulBU...@discussions.microsoft.com>
|
tutorial on calling cygwin bash scripts from powershell?
i've spent some time searching but haven't found much about this.
quite a few comparisons of pros and cons of, say, bash versus
powershell, but not much on calling back and forth between them.
I have used cygwin for years and have begung using powershell in the
past year or two; I find both extremely useful, but tend to use them
separately: each tends to be good for certain kinds of problems and
less good for others.
now, however, i want to tackle something I haven't managed yet:
calling a cygwin/bash script from inside a powershell script and using
the result to do something usef
|
6/22/2010 3:57:16 PM
|
3
|
Tim <t.han...@faz.de>
|
read Date notation
Can anybody help me with a ps script.
i have the beginning of the script :
$a = Get-Content c:\datdef.txt | Select-String "CurDefs"
output is this now :
CurDefs=20100620.006
i want to do this : 20-06-2010 006
thanks
Mike
|
6/21/2010 6:32:30 PM
|
4
|
"mike" <m...@hotmail.nl>
|
Copy files to server
Im trying to create and move the contents of a local folder up to multiple
servers via a server list. So Im trying to do something like:
$a=Get-Content "c:\scripts\serverlist.txt"
a$ | md data
cp c:\data\ a$ ?
I know thats wrong but you see the idea. Thanks in advance.
|
6/21/2010 9:57:53 PM
|
3
|
=?Utf-8?B?SWFuXzE=?= <fakea...@nodomain.com>
|
Enumerate through SharePoint lists | Complete Action
Here is my code:
[string]$url = "http://sp/Dashboard"
[string]$Field = "ProjectID"
[string]$Item = "3"
[void]
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
function FindLists() {
$site = New-Object Microsoft.SharePoint.SPSite($url)
$site.OpenWeb() | foreach { $_.Lists | test([string]$_.Lists) }
$site.Dispose()
}
function test([string]$list) {
write-host -url $url -List $list -Item $Item -Field $Field
}
I know where it's failing and that's because $list is returning all of
the lists all at once. The function test's
|
6/22/2010 12:21:09 AM
|
0
|
RemyMaza <remym...@gmail.com>
|
Save options and paths in vars
Hello!
At the moment I'm writing a small backup script with robocopy.
Robocopy offers serveral parameters. For example:
/XD exclude file list
/XF exlude dir list
/MIR Mirroring options
Within my backup script, all exclude files and dirs are stored in an
seperate variable:
For example:
$excludeFiles = "UsrClass.dat " + "UsrClass.dat.LOG1 " + "UsrClass.dat.LOG2
" + "ntuser.dat " + "ntuser.dat.LOG1 " + "ntuser.dat.LOG2"
At the end of my script I'm using all my prepared variables and execute
robocopy like this:
robocopy $sourcePath $tar
|
6/20/2010 11:20:07 AM
|
1
|
=?Utf-8?B?Rmxhc2hlci5EODQ=?= <Flasher....@discussions.microsoft.com>
|
Problem with "RemoveChild($_)"
I'm trying to use CleanBackups.ps1 described here:
http://imperfectit.blogspot.com/2010/03/automate-sharepoint-2010-farm-backups.html
This seems to be an excellent script, but unfortunately it ends with these
errors although there are some old folders to get rid of:
-----
Exception calling "RemoveChild" with "1" argument(s): "Object reference not
set
to an instance of an object."
At C:\Backup\cleanbackups.ps1:21 char:43
+ % { $sp.SPBackupRestoreHistory.RemoveChild <<<< ($_) }
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMeth
|
6/20/2010 10:13:51 AM
|
2
|
=?Utf-8?B?VHJvbmQgTWFobGU=?= <TrondMa...@discussions.microsoft.com>
|
trapping errors from commands entered interactively
If I enter a command that does not exist, here's what happens
PS C:> xyzzy
The term 'xyzzy' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try
again.
At line:1 char:6 + xyzzy <<<<
+ CategoryInfo : ObjectNotFound: (xyzzy:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there a way to trap this to be able to execute some custom PowerShell
code at that po
|
6/19/2010 6:36:00 PM
|
0
|
Larry__Weiss <...@airmail.net>
|
trapping an unrecognized command
If I enter a command that does not exist, here's what happens
PS C:> xyzzy
The term 'xyzzy' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:6 + xyzzy <<<<
+ CategoryInfo : ObjectNotFound: (xyzzy:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there a way to trap this to be able to execute some custom PowerShell
code at that point?
- L
|
6/19/2010 12:56:44 PM
|
0
|
Larry__Weiss <...@airmail.net>
|
Supressing Errors on my Screen
Hi,
I am running a script against a list of 165 servers. Part of the
reason I am running this script is to see if I can connect to all of
them. In many cases I can not. I get a screen full of Bright red Error
messages. Is there any way to suprpress these errors?
The command I am running is:
$OS = Get-WmiObject "Win32_OperatingSystem" -computername
($strComputer)
If ($OS) {
$WS.Cells.Item($rRow, 2) = "Online"
$WS.Cells.Item($rRow, 3) = $OS.Caption
} Else {
$ws.Cells.Item($rRow, 2) = "Pings"
$ws.Cells.Item($rRow,
|
6/18/2010 9:09:16 PM
|
2
|
OldDog <mikef2...@comcast.net>
|
Start-Demo.ps1
There are several versions of Start-Demo.ps1 available for downloading
http://blogs.msdn.com/b/powershell/archive/2007/03/03/start-demo-help-doing-demos-using-powershell.aspx
http://huddledmasses.org/powershell-start-demo-3/
http://blogs.itacademy.dk/post/5cStart-Demops1.aspx
Which version of Start-Demo.ps1 works best with PowerShell V2 ?
- Larry
|
6/17/2010 11:52:08 PM
|
11
|
Larry__Weiss <...@airmail.net>
|
Windows 2008 R2 and SQL SSMSE installation
Hi,
I am tring to install SQL 2008 R2 and SSMSE on a Server 2008 Server that has
already been upgraded to Powershell V2.
I have been unable to get Powershell V1 installed, even after removing
PoshV2, and downloading Poshv1, I get an error installing Posh V1, says this
update does not apply to your system.
If I install powershell via the deature mangement tool, it installs V2.
So how in the heck can I install SQL and SSMSE on Server 2008 R2, if SSMSE
requires PoshV1, and 2008 R2 comes with v2 by default?
Why does SSMSE hangup on v1 so much, isnt Posh suppose to be backwar
|
6/17/2010 10:38:01 PM
|
1
|
=?Utf-8?B?bW9zc2d1eQ==?= <moss...@discussions.microsoft.com>
|
powershell command for ms communicator 2007
Is there any command to enable microsoft office communicator 2007 for a user?
|
6/17/2010 3:47:49 PM
|
2
|
=?Utf-8?B?VmluYXlLVg==?= <Vina...@discussions.microsoft.com>
|
Setting values of a filtered array
Hi All
I want to read in a csv file, filter it based on the values of two of
the fields and set the value of another field. Here's a simple example
of what I'm trying to achieve:
c:\somefile.csv contents:
firstField,secondField,thirdField
1,2,"somevalue"
2,2,"avalue"
3,1,"somevalue"
# Import file into array
$csv = Import-Csv c:\somefile.csv
# Where secondField = 2 and thirdField = "someValue" set thirdField =
"anotherValue"
$csv | where {$_secondField -eq 2 -and $_.thirdField = "somevalue"} |
<set value of thirdField = "anotherValue">
How can I do this. As you can see,
|
6/17/2010 3:40:06 PM
|
1
|
mrboring <onyxa...@googlemail.com>
|
a function named variable:
To complement the built-in set of functions like
C:
D:
I added these lines to my profile.ps1
function alias: {Set-Location alias:}
function cert: {Set-Location cert:}
function env: {Set-Location env:}
function function: {Set-Location function:}
function HKCU: {Set-Location HKCU:}
function HKLM: {Set-Location HKLM:}
function variable: {Set-Location variable:}
All of those worked except I had to code variable: as
function global:variable: {Set-Location variable:}
But even then, I
|
6/17/2010 8:55:21 AM
|
3
|
Larry__Weiss <...@airmail.net>
|
How do a use a string as a param for a cmdlet when it contains opt
I have a script that cleans out old files, currently it is in this format
write-host "\\sapecc01\Integration\SCC\Archive\* -Include *.txt"
$a = Get-ChildItem \\sapecc01\Integration\SCC\Archive\* -Include *.txt
foreach($x in $a)
{
$y = ((Get-Date) - $x.CreationTime).Days
if ($y -gt 28 -and $x.PsISContainer -ne $True)
{$x.Delete()}
}
#Keep DESADV for 28 days
write-host "\\sapecc01\Integration\SCC\Archive\* -Include DESADV_*.xml"
$a = Get-ChildItem \\sapecc01\Integration\SCC\Archive\* -Include DESADV_*.xml
foreach($x in $a)
{
$y =
|
6/17/2010 5:14:19 AM
|
1
|
=?Utf-8?B?Sm9objIzMDg3Mw==?= <John230...@discussions.microsoft.com>
|
pstypenames
http://app.en25.com/e/es.aspx?s=1403&e=4513&elq=5704846539654ee18e58b4d31d7fb3ff
concerns the "hidden" property named pstypenames .
(Hidden in the sense that GetMember requires -Force to disclose it.)
For example:
PS C:> $a = 'Hello'
PS C:> $a.pstypenames
System.String
System.Object
PS C:> $a = 1
PS C:> $a.pstypenames
System.Int32
System.ValueType
System.Object
PS C:> $a = 1,2,3
PS C:> $a.pstypenames
System.Object[]
System.Array
System.Object
PS C:> $a[0].pstypenames
System.Int32
System.ValueType
System.Obje
|
6/16/2010 2:56:21 PM
|
1
|
Larry__Weiss <...@airmail.net>
|
Pulling data from a XML type variable
Hi,
I have a command line utility that queries the HBA's on a server and
return all sorts of usefull information.
What I am looking for is the World Wide Name of each port.
The Output looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<QLogic>
<AppName>SANsurfer FC CLI</AppName>
<AppVersion>v1.06.14 Build 25</AppVersion>
<HBA>
<GeneralInfo Number="0"
Model="QLA2312"
WWNN="##-##-##-##-##-##-##-##"
WWPN="##-##-##-##-##-##-##-##"
</HBA>
<H
|
6/15/2010 9:00:08 PM
|
11
|
OldDog <mikef2...@comcast.net>
|
Set-Acl very slow?
I put together a script that uses the SET-ACL cmdlet to apply file system
permissions to directories listed in an input file. The script seems to
work fine, but is extremely slow if the directory contains large number of
folders\files.
I put together a batch script that utilizes XCACLS.vbs which runs a lot
faster. I'm wondering why the powershell script is running slower. Does
anyone have any ideas?
Xcacls script completed in 10 minutes.
Powershell script was still processing after 18 hours.
Both scripts were configured to modify the same directories.
Both scripts w
|
6/15/2010 3:14:09 PM
|
1
|
=?Utf-8?B?QkJG?= <...@discussions.microsoft.com>
|
alternatives to suppress output
The following will destroy and recreate a subdirectory
if (Test-Path subdir) {rmdir subdir -Recurse}; mkdir subdir
but will produce output to the console:
PS C:> if (Test-Path subdir) {rmdir subdir -Recurse}; mkdir subdir
Directory: C:\Documents and Settings\Larry\My
Documents\WindowsPowerShell
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 6/15/2010 6:01 AM subdir
There are many ways to suppress the output to the console
if (Test-Path subdir) {rmdir subdir -Recurse}; mkdir
|
6/15/2010 11:13:16 AM
|
5
|
Larry__Weiss <...@airmail.net>
|
Setting the Boot Order with WSMAN
I am attempting to set the boot order of an Intel vPro client using AMT. I
am using the Invoke-WSManInstance cmdlet and am getting the following error:
#############################Beginning of
Error#########################################
Invoke-WSManAction : <a:Fault
xmlns:a="http://www.w3.org/2003/05/soap-envelope"><a:Code><a:Value>a:Sender</a:Value><a:S
ubcode><a:Value>b:ActionNotSupported</a:Value></a:Subcode></a:Code><a:Reason><a:Text xml:lang="en-US">The action is not
supported by the service.</a:Text></a:Reason><a:Detail /></a:Fault>
At C:\powershell\New\Invoke-ForceBoo
|
6/14/2010 8:55:54 PM
|
1
|
=?Utf-8?B?bWF0dHdhbGxpbmd0b24=?= <mattwalling...@discussions.microsoft.com>
|
Set Share Permissions to Everyone Full Control Remotely on SRVR 20
I have been trying for a couple days to create a share on a remote server and
assign "Everyone" "Full Control" on a 2008 R2 server. Apparently I am the
first person to ever do this on a remote server sinceI can not find a
solution. The scriopt works locally, but not remotely.
I can create the share on the remote server, but can not set Everyone to
have full control. No errors, it just doesn't work. If I use VBScript I
can, but not Powershell. Very weird, it seems as though you are unable to do
this on a remote server (2008 Server R2 - UAC off) I am an Administrator, of
c
|
6/14/2010 4:32:05 PM
|
0
|
=?Utf-8?B?RGVuaXM=?= <De...@discussions.microsoft.com>
|
Set ownership of home directory to each user.
From what i have read powershell only allows for setting owner to a domain
admin or the user executing the script. Has this changed or does .net offer
a way for me to loop through a list of home dirs and set there owner to the
individual users account?
|
6/10/2010 7:50:27 PM
|
1
|
=?Utf-8?B?SmFjb2IgU2FtcHNvbg==?= <JacobSamp...@discussions.microsoft.com>
|
check for file content in different paths out of a textfile
hi there
sorry guys..for you this might be a simple question. but i am new to
powershell and i am queued to following problem:
1: i have a text file (array.txt), which is automatically generated. the
content of this file are 5 lines. each line points as unc path to a location.
how can i automatically check in each unc path of this file if there are
files in the folder? i tried to use an array and also a foreach solution but
i cant find the way to it.
2: the above mentioned text file has (after the automatic generation of it)
several blank lines. how i can prevent the crea
|
6/10/2010 1:34:35 PM
|
2
|
=?Utf-8?B?ZHVtYm8=?= <du...@discussions.microsoft.com>
|
New-WSManInstance
I'm trying to use Power Shell to instantiate a new WSMAN object. In this
particular case, I was trying to instantiate an AMT_Hdr8021Filter.
I'm able to use WinRM to create this object from C#, but not from
powershell... When I try to use New-WSManInstance, I get an "Access Denied"
error. When I try to use the Invoke-WSManAction method, I get a "No Route"
error..
I looked at network traces, and found the XML sent on the wire from
powershell to be different than from WinRM in C#. When I use
New-WSManInstance, nothing is ever sent on the wire, it just says "Access
Denied"...
|
6/10/2010 1:38:15 AM
|
0
|
=?Utf-8?B?U3Rhcl9TY3JlYW1lcg==?= <StarScrea...@discussions.microsoft.com>
|
Variables and .value
Heres a simple script I've knocked together, largely by trial an error
#WhereAmI.ps1
$usr=gci env:username
$comp=gci env:computername
$IPadd = ([System.Net.Dns]::GetHostAddresses($_) |select $_.ToString)
$dom=gci env:userdnsdomain
write-host
"Formatted with Write-Host:"
write-host $(" Username:",$usr.value) -foregroundcolor DarkGreen
write-host $(" Computer:",$comp.value) -foregroundcolor red
write-host $(" IP Address:", $IPadd) -foregroundcolor gray
write-host $(" Domain:",$dom.value) -foregroundcolor DarkYellow
write-host
"Without formatting:"
$usr
$comp
$IPadd.
|
6/8/2010 7:42:49 PM
|
5
|
Simon Sheppard <Si...@nospam.invalid>
|
List servers and their DNS server settings
I am trying to get a list of server names and their primary and secondary
DNS server settings.
If I try the following command:
get-wmiobject Win32_networkadapterconfiguration -computername "servername |
select name, DNSServerSearchOrder
It would give me the specific servername and its dns addresses.
I know have a list of computernames which I would like to list out and their
DNSserversearchorder settings (DNS settings)
I tried putting the list of computernames in a text file by using
get-qadcomputer | export-csv C:\computername.txt -notype
Then I used the get-content
|
6/8/2010 12:09:45 PM
|
3
|
"guv" <...@>
|