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 ArticleSearch 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 ArticleReply 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 ArticleReply 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 ArticleWrite-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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply To: How to remove Drive Letter in PowerShell way
In Win8/2012 and newer OSs, yes. Remove-PSDrive
View ArticleReply 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 ArticleGet-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 ArticleReply 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 ArticleReply 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 Articlewindows 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 ArticleSearch 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 ArticleReply 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