powershell

Powershell: How to recursivelly delete all svn files

How would one go about deleting all subversion files from directory using Powershell? ...

In WMI, can I use a join (or something similar) to acquire the IisWebServer object for a site, given server name and deployment location

Given a server name and a physical path, I'd like to be able to hunt down the IISWebServer object and ApplicationPool. Website url is also an acceptable input. Our technologies are IIS 6, WMI, and access via C# or Powershell 2. I'm certain this would be easier with IIS 7 its managed API. We don't have that yet. Here's what I can do: ...

Why does the Monthly Rate output show 0.01% when I input 10? I expected 0.1% 0r 0.10%

#loan calculator...just messing around for practice cls $choice = 0 while ($choice -ne 1){ [string]$name = read-host "Enter name" [double]$amount = read-host "Enter loan amount" [double]$apr = $(0.01 * (read-host "Enter APR")) [int]$term = read-host "Enter term in months" $rate = $apr/12 $mr = $rate * [math]::...

I wanted to create a user profile in sharepoint using powershell scripting

I have used the below code for fetching the user profile from sharepoint 2010.Error I am getting is object $cm is returning as null. $site = Get-SPSite($PortalURL); $servercontext = [Microsoft.Office.Server.ServerContext]::GetContext($site); $site.Dispose(); Return the UserProfileConfigManager $cm = New-Object Microsoft.Office.Server....

InternetExplorer.Application : Select multiple "option value" fields

Trying IE Automation with Powershell. Task: Select multiple option value fields and click submitbutton. HTML looks like: : : : <center><input type="hidden" name="HF_certType" value="x509"><select name="HF_rvk" size="8" multiple> <option selected value = "Line 1">Line 1 Option</option> <option value = "Line 2">Line 2 Option</option> <op...

Powershell Get-ChildItem -Include/-Exclude doesn't filter if passed as an arg to a function

Having a problem getting a filter argument to Get-ChildItem in a function The following works fine and displays a whole list of files: c:\temp\Get-ChildItem -Include deleteme.txt -Recurse Now say I have the following script file starts here filename = GetLastFile.ps1 param([string] $filter) $files = Get-ChildItem $filter Write-Ho...

Use powershell to automate file download from website (dont know the url to file)

I want to automate a daily download of a report from our credit card provider's website. The file is dynamically generated, so I wont know the actual URL for the file itself. I'm able to use powershell to navigate and login to the web page, and to click the "Download Report" button. But then the "File Download" dialog box appears, and...

Programmatically modify Firewall rules in Windows Server 2008 R2

I want be able to programmatically enable, disable, create firewall rules in Windows Server 2008 R2. What is the object model to modify the firewall rules from .Net/PowerShell? ...

PowerShell 2.0: Accessing Windows Shares during a Remote Session

I am having trouble accessing a shared network location while within a PowerShell remote session. From the PowerShell prompt, I enter a new session: Enter-PSSession server1 The session is properly created and entered. I then attempt to list the contents of the share: dir \\server2\share1 The response is this error: Get-ChildItem ...

Finding table data via Internet Explorer COM

I am trying to automate a download of some data from a web application via Powershell/Internet Explorer COM similar to this article. This works fine for normal elements/pull-downs, but how do navigate through tables via the COM object in case I want to click/find out the links inside a table? ...

Add New ServerBinding to IIS 6 site using WMI and Powershell

Given a valid $server, the following code will move all the ServerBindings from their existing subnet to a nice, shiny new one at 1.1.1. $objWMI = [WmiSearcher] "Select * From IIsWebServerSetting WHERE Name = 'w3svc/10'" $objWMI.Scope.Path = "\\" + $server + "\root\microsoftiisv2" $objWMI.Scope.Options.Authentication = 6 $sites =...

How to update existing IIS 6 Web Site using PowerShell

Hi, I am trying to create a PowerShell script that creates a new IIS 6 web site and sets things like App Pool, Wildcard application maps, ASP.NET version, etc. After extensive search on the Internet I found a script that allows me to create a new Web Site but not to modify all the properties I need. $newWebsiteName = "WebSiteName...

Finding ALL installed applications with PowerShell?

I am trying to use Windows PowerShell 2.0 to find an installed application. I have tried two methods, one using WMI and one using the Registry. Both methods are able to bring up a large list of installed applications and components, however neither one seems to bring up the application I am interested in. I am specifically looking for ...

PowerShell Script Running as a Service Behaves Strangely

PowerShell Script Running as a Service Behaves Strangely The Project: Create a background process that determines if the on board network card is connected. If it is connected, disable the wireless network card. When the onboard network card is not connected, re-enable the wireless card. Why: Users hot-dock all the time, getting funky ...

Start/Stop App Pool IIS6.0 with Powershell or command line

Hi, I'm using IIS 6.0 and looking for a way to stop/start the app pool. I know there is a stop-appPool for powershell in 7.0 but using 6.0. :-( So does anyone have a powershell script or another command line exe that will stop/start the app pool? Thanks. ...

Run Command as administrator in PowerShell script. UAC

OK here is my issue: I am trying to run a script remotely on a server. I am an administrator on both boxes, firewall exceptions are in place, remote admin is enabled, and everything else looks good that i can see. invoke-command -ComputerName $ComputerName -ScriptBlock ` { cd C:\Windows\System32\inetsrv\; ./appcmd.exe ADD ...

Powershell filter files by SQL Server result set and copy

I am executing a query in SQL Server and returning a single column result set. I need to loop through the result set and find file names matching the record from the result set. Part of the file name is a sequence number. I need to sort the files in ascending order, select the first file, and then copy only that file to a subdirectory. T...

How to format a datetime in Powershell

Hi, So I can format the Get-Date commandlette no problem like this: $date = Get-Date -format "yyyyMMdd" but once I've got a date in a variable, how do I format it. This errors: $dateStr = $date -format "yyyMMdd" saying: "You must provide a value expression on the right-hand side of the '-f' operator" ...

how to disable listview column resizing?

I want to disable listview column resizing. How can i do it? ...

a question about forms in powershell

my script uses two forms. i want to close second form after opening first one. how can i do it? ...