Quantcast
Channel: Windows PowerShell forum
Browsing all 21975 articles
Browse latest View live

[BUG] in Start-Job cmdlet when piping job's name to the cmdlet: the resulting...

Consider this script:$job=[pscustomobject]@{Name='Qwerty'} | sajb -ScriptBlock {ps}The job is created, successfully, with the name specified above.It can be seen commanding:gjbNonetheless, trying to...

View Article


Use Same Excel Object in Start-Job as Main PS1

I have hundreds of Excel files and one main file that has links to each of these files, but in order for the data to be pulled into the main excel file I need to have every file opened within the same...

View Article


Clearing Out Bleeding Scripts when using GWMI

OK, so I may be in the minority, but I don't like when the scripts I write bleed all over my screen.  And when I use GWMI, I find that they bleed more often than not.  See, I often work with systems...

View Article

MSSQL 2012 Backup Timeout

Dear Microsoft Technet Team,we have an issue regarding creating a Backup using Powershell. Each time we try backing up on special database we get into a timeout after 10 minutes (default connection...

View Article

Best way to determine if all array elements are equal

I have an array that I want to check if each element is equal to each other or not.  It does not matter the actual value. What is the most efficient way to do this?

View Article


Image may be NSFW.
Clik here to view.

Hyper-V Powershell cmdlets 2008 R2

I just want Hyper-V cmdlets to work on 2008 R2..googled, and googled, and have been all over the place, reading different stuff, attempting different solutions..Have read that its not possible, have...

View Article

Check Server startUp for multiple servers

I have 2 requirements to check on 1000 of servers;-1. Get the Nicsettings2. Get the System Startup time.I am able to get the results on one server, but when I try the below code for multiple servers,...

View Article

Create All User Logon Scheduled Task

I have created such a task manually, and it seems only to run for the user account where I created it, even though I changed the Trigger to Any User. I assume since the setting is there, that this does...

View Article


Edit DNS Zone files with PowerShell

I recently spent a couple of days trying to transfer DNS server zone files from an older public DNS server (Windows 2008) to a new replacement (Windows 2012 R2) at a different IP address. This involved...

View Article


Delete files through WMI based on date?

Hello,I have to delete files remotely on Windows 2003 server without WinRM in place and hence only have access to WMI to manage. I'm running latest OS and PowerShell on front-end though.My question is...

View Article

PowerShell processing of large CSV very slow - Is there a better way?

Using Powershell I am working through a foreach loop. One of the steps inside the loop is to find a match in a csv file -   import-csv ".\RateCard.csv" | where-object{$($Item.'From Number') -match...

View Article

How to properly escape special characters in string?

Hello,I want to write a string with FreeSpace for object called $a below but can not figure out how to properly expand expression inside string since escape characters seems to be interacting with...

View Article

Import-PSSession : Attribute cannot be added because it would cause the...

Greetings. I'm defining a variable in my param block:# log file folder - defaults to creating a "\logs" folder in the folder where the script resides [Parameter(ValueFromPipeline = $False,...

View Article


Tail File and Notify

Hi All, I have this code $computer = gc env:computername Get-Content -Path 'C:\temp\error.log' -Tail 1 -Wait | where {$_.contains("error")} | ForEach-Object -Process {send-mailmessage -SMTPServer...

View Article

Exchange Powershell return value from Get-command to variable.

HiI am trying to create a powershell-script for our monitoring-software.The script is supposed to establish a connection to our exchange-server mgmt-shell and execute this...

View Article


Powershell script to revoke an O365 license based on an AD attribute.

I've seen many articles on how to use powershell to automatically provision users based on an AD attribute. What I'm not seeing is the opposite. A script to revoke an O365 license based on an AD...

View Article

import-module Lync

heyi use powershell v3 from win7 , i installed ocscore.msi and try to import-module Lyncbut i get error : the assembly ‘microsoft.rtc.management’ was not loaded because no assembly was foundwhy it...

View Article


Repadmin /showrepl can't get all site DC

My DCDC-AD-DC  is Site1-AD-DC  is Site2-AD-DC  is Site3-AD-DC  is Site4-AD-DC  is Site5-AD-DC  is Site6when user log-in each authen via AD-DC at sitewhen i run below script on DC, report can't get...

View Article

PowerShell Copy Biggest (file size) File to Destination

Hi guys, I have the following code, works butter smooth. Copies a few files/folders from source to destination then applies ACL's. See that 3rd "copy-item" which gets a .nk2 and copies it over? Well in...

View Article

Image may be NSFW.
Clik here to view.

Changing current culture

I need to change the current culture for a script and nothing I tried works.I've tried using the Set-Culture cmdlet.I've trued setting [System.Threading.Thread]::CurrentThread.CurrentCulture.Is this at...

View Article
Browsing all 21975 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>