header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Search
Search Area
Criteria Options
Search Topics From
Search By User
Search in Forum(s)
Included Forums: ALL
Topic
RE: Help With If/Else and Varibles
I would use a custom object to track the name of the server through the pipelin. Couple of possible options, depending on which version of Powershell - Version 1Get-Content list.txt ForEach-Object { $result = New ...
by Steven Murawski in General PowerShell on 22 Feb 2010 10:55 AM
RE: Help With If/Else and Varibles
$_ is the current object in the pipeline, but your if statement is not part of a pipeline, so it has no value. We could trim this down a bit.. $Computers = Read-Host "Enter Machine Name" $NewPass = Read-Host "Enter New Password" Get-QADC ...
by Steven Murawski in General PowerShell on 19 Feb 2010 12:47 PM
RE: Need AWK and SED Functionality
If you only need the value (and don't want it as a property), you could also do something like : For V1: $ea = Get-QADUser -Name aws3 -IncludedProperties name,extensionAttribute1 | Foreach-Object {$_.extensionAttribute1 } For V2: $ea = Get-Q ...
by Steven Murawski in Active Directory on 19 Feb 2010 06:49 AM
RE: Storing Exception message from TRAP as variable
One caution with this approach.. if you trap more than one error, you will only end up with the last error stored in $errormsg. In your trap, you might want to: test if $errormsg exists, if it does test if it is an array if it ...
by Steven Murawski in General PowerShell on 14 Feb 2010 05:17 AM
RE: foreach very slow
I'll have to look a bit closer for some perfomance suggestions (should have some time this weekend), but you might have some unintended consequences with your "-ErrorVariable" assignments. By default, the ErrorVariable will replace the existing v ...
by Steven Murawski in Peer Review on 12 Feb 2010 12:26 PM
RE: need help with compare object feature...
Are you using V1 of PowerShell? If so, it might be an issue with the -SyncWindow property. The SyncWindow parameter decides how far up and down the other list to search for a match. What could be happening is that with the order of the object ...
by Steven Murawski in Exchange Server on 12 Feb 2010 10:16 AM
RE: Is it possible to add indexes to a Powershell Datatable?
I don't believe so. Indexes are a function of SQL Server (or other databases) which can help minimize the number of reads from disk to determine the result of a query. Datatables are class that approximates a table from SQL Server, but it is not ...
by Steven Murawski in General PowerShell on 10 Feb 2010 08:28 AM
RE: signing powershell script
In re-reading your question, if a cert is not a code signing cert (a class 2 certificate), you will need to get a new one issued.
by Steven Murawski in General PowerShell on 15 Jan 2010 07:44 AM
RE: signing powershell script
You should be able to use the certificate infrastructure from AD to generate your PFX and codesignng cert. Here's a good step by step from Technet. Since you have the *.cer file, you should be able to skip to the export portion of the instructio ...
by Steven Murawski in General PowerShell on 15 Jan 2010 07:40 AM
RE: signing powershell script
To verify that you have a code signing cert installed, you can try Get-ChildItem cert:\ -recurse -codesigningcert which will run through all of the certs on your computer and list out the code signing certs. If you have valid code signing certi ...
by Steven Murawski in General PowerShell on 15 Jan 2010 07:12 AM
RE: Why is powershell important
Marco's got some good suggestions, and I've talked a bit about this on the last two episodes of Mind of Root (shows 126 and 127). We will also have Jeff Hicks on this Wednesday evening to talk about promoting PowerShell. You might be interested ...
by Steven Murawski in General PowerShell on 12 Jan 2010 09:16 AM
RE: Access 2003 MDB via ADO.NET instead of ADO
I would guess most of those examples are direct ports from vbscript. Since PowerShell is build on .NET, I prefer to go the .NET route first and then look to COM, WMI, or native commands. I'm sure there are other tasks where the COM or native s ...
by Steven Murawski in Working with .NET on 11 Jan 2010 08:20 AM
RE: Access 2003 MDB via ADO.NET instead of ADO
Any time. How's the performance? Any better?
by Steven Murawski in Working with .NET on 11 Jan 2010 08:01 AM
RE: Access 2003 MDB via ADO.NET instead of ADO
Welcome to PoshComm.org.. A great comprehensive script for accessing data from SQL Server, Excel, or Access can be found on Lee Holmes blog - http://www.leeholmes.com/blog/InteractingWithSQLDatabasesInPowerShellInvokeSqlCommand.aspx For the ...
by Steven Murawski in Working with .NET on 11 Jan 2010 07:32 AM
RE: Some module scripts cannot be signed with the Set-AuthenticodeSignature cmdlet
Check the file encoding on those files.. Set-AuthenticodeSignature chokes on Unicode files. There is a Connect bug filed - https://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=483431&wa=wsignin1.0 To fix this, you can r ...
by Steven Murawski in General PowerShell on 07 Jan 2010 05:35 PM
RE: Calling PowerShell from outside script
Let's walk through the script.. # Retrieve all the exchange servers that match the below criteria $exchangeservers = Get-ExchangeServer |where-object {$_.admindisplayversion.major -eq 8 -and $_.IsMailboxServer -eq $true } ...
by Steven Murawski in Exchange Server on 06 Jan 2010 05:15 PM
RE: Calling PowerShell from outside script
Quick question, what is your intention for the escape characters in front of the backslashes in $path = "`\`\" + $server + "`\" + ....
by Steven Murawski in Exchange Server on 06 Jan 2010 04:39 PM
RE: foreach problem
Douglas, Are all of the hostnames resovlable? Looks like there is a problem finding the server. One way to check to see if your array of server names is being passed how you expect is to change your command that does something to one that jus ...
by Steven Murawski in General PowerShell on 06 Jan 2010 01:48 PM
RE: Some assistance with powershell
if that quote is your exact command line, you are missing a "}" Example: Import-Csv recipients.csv | foreach { New-Mailbox –alias $_.Alias –name $_.Name –UserPrincipalName $_.UPN –Database “mailbox database” –OrganizationalUnit Users –Password $Pass ...
by Steven Murawski in Exchange Server on 06 Jan 2010 01:36 PM
RE: C# and powershell
Good luck. Post questions as you come across them!
by Steven Murawski in Working with .NET on 30 Dec 2009 12:50 PM
RE: C# and powershell
I enjoyed the PDC videoes as well. The slides and samples were posted on the PowerShell Team Blog - http://blogs.msdn.com/powershell/archive/2009/11/19/pdc09-svr12-and-svr13-demos-session-demos.aspx
by Steven Murawski in Working with .NET on 30 Dec 2009 12:26 PM
RE: C# and powershell
There are some samples available from Microsoft - http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=50633a1f-a665-425d-923c-1a269f8ac084 Other good options are : PoshConsole - http://www.codeplex.com/Wikipage?ProjectName=P ...
by Steven Murawski in Working with .NET on 30 Dec 2009 12:24 PM
RE: Access a protected dir using system.net.webclient via Powershell
My pleasure! Glad I could help. Thank you for being such an active forum user. I hope you find PowerShellCommunity.Org to be a quality resource.
by Steven Murawski in General PowerShell on 16 Dec 2009 12:20 PM
RE: Access a protected dir using system.net.webclient via Powershell
The WebClient class can pass your credentials for you via the credentials property.$Username = 'MyUsername' $Password = 'MyPassword' $Target = "http://www.WebSite.com/PasswordProtectedDir/HelloWorld.html" ...
by Steven Murawski in General PowerShell on 16 Dec 2009 09:10 AM
RE: Help with outputting value
Actually, that makes it simpler.   (I thought you were getting back one object per store, not per mailbox.)foreach ($ES in $exchangestores) { Get-WmiObject -Namespace root\microsoftexchangev2 -Comp ...
by Steven Murawski in General PowerShell on 14 Dec 2009 03:34 PM
RE: Help with outputting value
Creating the measurement object based on the size property discards the rest of the information that you returned from Get-WMIObject, which makes it hard to find the name for the store.What I would look at doing is using ForEach-Object and saving th ...
by Steven Murawski in General PowerShell on 14 Dec 2009 12:17 PM
RE: Can I turn an AdvancedFunction in to a C# Cmdlet? (My1st CMDlet)
The structure of a cmdlet in C# is very similar to the advanced functions. Like you thought, the logic from your process block will go into the process method. The Try/Catch block is there for error handling. To accept pipeline input, you h ...
by Steven Murawski in Cmdlet Development on 11 Dec 2009 05:04 AM
RE: system administrator not a programmer
@trevor - Well said!
by Steven Murawski in General PowerShell on 09 Dec 2009 05:49 AM
RE: loop in script not working....
In your script, where is $user coming from?  In the foreach, the current object is represented by $_, so maybe you mean something like$error.clear()            $newdom = "@domain.com"            $orgu = 'OU' Get-mailbox -Organizationalunit $orgu -Re ...
by Steven Murawski in Exchange Server on 02 Dec 2009 01:57 PM
RE: Get-Content Variable not working
Probably not.. you could just call Trim() on $computer1 like $diskinfo = get-wmiobject win32_logicaldisk -filter "deviceid='c:'" -computername $computer1.trim()
by Steven Murawski in General PowerShell on 01 Dec 2009 01:44 PM
Page 1 of 512345 > >>
Active Forums 4.3
right
footer   footer
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
footer   footer