powershell

Connecting to a network folder with username/password in Powershell

I often access shared network folders in Powershell to grab files etc. But if the share requires a username/password, Powershell does not prompt me for these, unlike Windows Explorer. If I connect to the folder first in Windows Explorer, Powershell will then allow me to connect. How can I authenticate myself in Powershell? ...

PSake extensions?

I recently discovered Powershell and through that PSake. If you are using it and you've extended it or created tasks for it, please share! ...

Environment variables in powershell with a dot(.) in the name

I know I can access environment variables in powershell using $Env. For example, I can access FOO with $Env:FOO What I can't figure out is how to access the environment variable called FOO.BAR $Env:FOO.BAR doesn't work. How can I access this from within Powershell? ...

Powershell script to change service account

Does anyone have a Powershell script to change the credentials used by a Windows service? ...

Using powershell, how do I grant "Log on as service" to an account?

I'm trying to use powershell to configure the account credentials, but I need to grant the account "Log on as a service" right in order for it to work. How can I do this in powershell? ...

powershell : how to query AD and exchange mailbox sizes

I just recently found out that exchange server2007 will no longer be supporting WMI, namely the service which uses \ROOT\MicrosoftExchangeV2. The old script I wrote output the ServerName, StorageGroupName, Storename, MailboxDisplayName, Size, TotalItems, DeletedMessageSizeExtended fields to a csv text file. How would I go about doing...

Is it possible to open an explorer window from powershell

I'm sure this must be possible, but I can't find out how to do it. Any clues? ...

Set Event Log settings via GPO

How would I set the "overwrite as needed" setting on Event logs other than Application/Security/System? Specifically I'd like to apply this to the Powershell and Windows Powershell Logs, in addition to any other future logs that may be added. This needs to be applied to both server 2003 & 2008. ...

Powershell remoting with V1

Do you know of any good remoting solutions using powershell V1 (I know the V2 stuff is awesome, but my organization doesn't like using pre-release software). I don't need anything spectactular, just a way to kick off powershell script on another box and get the results back when they're done. I'm considering using sysinternals PSEXEC a...

How can I replace newlines using powershell?

Given test.txt containing: test message I want to end up with: testing a message I think the following should work but it doesn't: Get-Content test.txt |% {$_-replace "t`r`n", "ting`r`na "} How can I do a find and replace where what I'm finding contains CRLF? ...

Changing IIS6 Site Home Directory with Powershell (answered)

I'm trying to change a site's home directory using powershell. This is what I have so far, but it isn't saving the changes... $server = "localhost" $siteName = "mysite" $iis = [ADSI]"IIS://$server/W3SVC" $site = $iis.psbase.children | where { $_.keyType -eq "IIsWebServer" -AND $_.ServerComment -eq $siteName } $path = [adsi]($si...

PowerShell based database synchronisation using a binary file

I have written a database application using a binary file as storage. it is accessed via powershell cmdlets. You can put information into the database using the put- and you can read information using get-. The problem is synchronisation. What is the best way to ensure that the cmdlets don't access the file at the same time? The put- ...

exchange powershell : get-user has no Description property? (solved)

When I run get-user|get-member in powershell with the exchange add-in I noticed there is no description property. Does anyone know if it has been renamed to something else or another way of accessing it? ...

exchange powershell : finding the active directory office property (solved)

I wrote this small script to pull the office property from get-user by piping the exchange mailbox object. $server = "tms08" $arrUser = get-mailbox -Server $server |Get-MailboxStatistics |select identity foreach ( $id in $arrUuser) { $office = get-user -Identity $id.Identity |select office $out += $id.Identity } $out I don't get any...

How can I change features in Windows Vista programatically?

I'm looking for a way to programatically change features ("Programs and Features" -> "Turn Windows Features on or off") in Windows Vista (and newer Redmond OS, e.g. Server 2008). Ideal solution would be in the form of a Powershell script (Get-Features, Set-Features), however any pointers to MSDN/other documentation would be very welcome...

Is there a way to query who are activesync/bb users through Exchange PowerShell?

Is there a way to query against exchange 2007 to distinguish who is either an active sync or blackberry user using powershell exchange addin? ...

What is the best way to send HTTP requests from Windows Powershell?

What is the best way to send HTTP requests from Windows Powershell? ...

powershell exchange : how do you setup a scheduled task to run exchange2007 powershell? (solved)

I'm having trouble setting up a scheduled task (now called Task Scheduler) under the actions tab to run on windows 2007 server. It also has exchange server 2007. I've tried setting Program/script : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Add arguments (optional): -psconsolefile exshell.psc1 -command "& {c:\mes-detai...

How do I create powershell 2.0 modules?

I've heard powershell 2.0 CTP has modules, but I can't find much example code or instructions. I've read what little help there seems to be online... But I just keep getting "The term 'Add-Module' is not recognized as a cmdlet..." when I try and load a module. Any help would be gratefully received! Edit (July 2010) Please note this qu...

powershell : how to format get-date to string and remove 0's?

I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: $filedate = get-date -uformat "%m-%d-%Y" $filedate = $filedate.ToString().Replace("0", "") this returns "01-04-2008" I want to the output to be "1-4-2008" any ideas on another way of doing this? thanks in advance ...