Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Cannot find an overload for /"AddPrinterConnection"/

I am new to Powershell. I am trying to map network printers based on room name. One of the rooms requires 4 printers. The script works on Windows 7 just fine. If I run it on Windows 8.1, the first...

View Article


Search Internet Explorer Object

I am new to powershell, and am trying to write a script that opens Internet Explorer, navigates to a page, then searches that page for a string of text. Here is the beginning of my code, I just can’t...

View Article


Reply To: Cannot find an overload for /"AddPrinterConnection"/

You’re mixing up AddWindowsPrinterConnection() and AddPrinterConnection(). The former is what you appear to need; AddPrinterConnection() takes 2-5 arguments and is for mapping local ports (such as...

View Article

Reply To: Search Internet Explorer Object

Are you fixed on using Internet Explorer for this? You’d have an easier time using Invoke-WebRequest, in PowerShell. For example: $response = Invoke-WebRequest -Uri 'http://www.example.com' $response...

View Article

Write-Progress problems

I am trying to display a progress bar with the write-progress cmdlet for a change in ip address settings. I have the interface $iface = Get-WMiObject Win32_NetworkAdapterConfiguration |...

View Article


Reply To: Write-Progress problems

I’m not sure Write-Progress is the right tool here. These steps should complete very quickly, and the progress indicator would just flash by. For example: Write-Progress -Activity 'Configuring Network...

View Article

Reply To: WriteOutput help

On a side note, you can just pipe $fileEntries straight to Out-File, with no need for your own foreach loop: $fileEntries = [IO.Directory]::GetFiles("\\cd1001-c100\public\isantillan", "*.*",...

View Article

Reply To: Write-Progress problems

Dave Wyatt wrote: I’m not sure Write-Progress is the right tool here. These steps should complete very quickly, and the progress indicator would just flash by. For example: Write-Progress -Activity...

View Article


Reply To: Write-Progress problems

Ah, looks like -Status was a mandatory parameter in PowerShell 2.0; I assume that’s what you’re running? You can add it to each of the calls to Write-Progress, if so: Write-Progress -Activity...

View Article


Reply To: Write-Progress problems

Dave Wyatt wrote: Ah, looks like -Status was a mandatory parameter in PowerShell 2.0; I assume that’s what you’re running? You can add it to each of the calls to Write-Progress, if so: Write-Progress...

View Article

Reply To: Write-Progress problems

It looks like you’ve put multiple statements on the same line, somehow. There should be a line break between “-PercentComplete xx” and $iface.Whatever()

View Article

Reply To: Write-Progress problems

Dave Wyatt wrote: It looks like you’ve put multiple statements on the same line, somehow. There should be a line break between “-PercentComplete xx” and $iface.Whatever() Silly me hahaha Thank you...

View Article

Reply To: How to remove Drive Letter in PowerShell way

In Win8/2012 and newer OSs, yes. Remove-PSDrive

View Article


Reply To: securely storing passwords for reuse w/o exposing them

Dave & Robert, thanks both for responding. What a nice coincidence, I’ll go read up on session configurations and follow that blog series then.

View Article

Get-DhcpServerv4Lease cmdlet returns error

My Windows 2012R2 Server running powershell is a memberserver, the DHCP Server is a Windows 2003 Server I tried running below command Get-DhcpServerv4Lease -Computername DHCPSERVERNAME Scope...

View Article


Reply To: How to remove Drive Letter in PowerShell way

Sorry, but it is not a solution. I need to remove Drive Letter from Physical Drive. Remove-PSDrive cannot delete Windows physical or logical drives. It works only with mapped network drives.

View Article

Reply To: How to remove Drive Letter in PowerShell way

This seems to work: $target = 'G:' $volume = Get-WmiObject Win32_Volume -Filter "DriveLetter='$target'" if ($null -ne $volume) { $volume.DriveLetter = $null $volume.Put() } I haven’t figured out a way...

View Article


windows RT ps-remoting

I haven’t had another computer off the domain to test as of yet but I use remote desktop to run PowerShell and admin a high school network from my surface RT. there is PowerShell on my surface why...

View Article

Search and Replace CRLF

Trying to replace CRLF in a small PowerShell script Works OK with standard characters bit not with `n ; file.txt look like this: Line1 Line2 Line3 Line4 would like the file to look like this:...

View Article

Reply To: Search and Replace CRLF

Get-Content returns an array of strings, by default, and those strings will not include the actual CR/LF characters that were present in the file. All you need to do is use the -join operator to...

View Article
Browsing all 13067 articles
Browse latest View live