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

LDAP Query to exclude expired accounts

I have a script that has been running fine for a while, but some issues have come up with recent changes in our organization.The main LDAP query I was using is:$searcher.Filter =...

View Article


Powershell script Add-computer "" -OUPath "" failing when executed.

Good afternoon,I have the following script that is ran manually with elevated rights to join a windows 7 workstation to a domain and to the right OU.Add-Computer -domainname "org domain" -OUPath...

View Article


New-Item using csv file

I am trying to use a csv file with the new-item and then the copy.This works well on its own$UserName = Read-host "Enter User Name" New-Item E:\PST\WHD\$username -type directory $PST = Get-ChildItem...

View Article

Sharepoint batch delete from cvs file Powershell script not working

Hi,I'm trying to use a Powershell script to check if a SharePoint list contains items from a cvs file. If there is a match the script should delete the item from the SharePoint list and move on to the...

View Article

secure password input while handling special characters

Hello,I am trying to create a bat file to allow password input at the command prompt.  I use powershell with the following command:::...

View Article


Debug Prompt not coming when Powershel breakpoint hit

Hi,I have created a breakpoint as followsSet-PSBreakpoint -Command get-process -Script C:\Temp\SP\AutoSPInstaller\AutoSPInstallerFunctions.ps1or Set-PSBreakpoint -Script...

View Article

Powershell script to change DNS

$computer = get-content "C:\dns\dns.txt" $NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -computername $computer |where{$_.IPEnabled -eq “TRUE”} | select PScomputerName,DNSServersearchOrder |...

View Article

powershell to retrieve certificate expiration date from list computers.

Hi, we need to retrieve certificate expiration date from a list of computers on personal certificates of certificates(local computer).  when I ran the script below, it always sopped after two results....

View Article


[Powershell] lastlogondate exactly 90 days ago

Dear All, I beg for help as I'm in a need to build a "GET-ADUSER" command which will find :1. enabled 2. not used exactly 90 days (not 89 & not 91+) 3. with specific value of "EmployeeID" attribute...

View Article


Set pscustomobject to return only a specific property

HiI don't know if it possible or make sense but is it possible to make an object return only one of its properties when called?What I mean is, I want to create a "tree" of objects (for example a tree...

View Article

Identifying the first Sunday of a month...

Evening,I hope that one of you can help me.I need to write a script that on the first day of every month FTP downloads a file to an archieve area and uploads it to a diffrent FTP site (as i keep...

View Article

Using LanManServer with Powershell to get Share level permissions & Setup...

hi Script Guy,I would like to know the how to use LanManServer with Powershell to get share level permissions. And apply share level permissions. I have the two following powershell script that can...

View Article

Unable to set user account properties

I'm trying to write a script where I ensure that local user accounts are set with the proper configurations. I can access all of the properties, but I'm getting error messages every time I try to...

View Article


Powerchell: Scan users in multiple AD OU

Hi i have a problem that i need you to help to solve, I want so search through multiple OU´s for Users. I have it working for one OU but i need to make a script that can search through multiple I am...

View Article

-ConfigPath not working

Hello,I am trying to execute the following script but I keep getting the following error...ERROR: Unable to locate environment configurationSCRIPT: powershell d:\util\ControlM\DEV\Tools\Wrapper.ps1...

View Article


ps script to archive folders only when the folder has certain file types

How to write powershell script to archive folders only when the folder has files of certain type for instance (.txt, .csv, .xls, .xlsx). My source path is "C:\Temp\Test\" and there are 5...

View Article

Problems with get-scheduledtask

I'm monitoring multiple 2012 R2 servers (all deployed roughly at the same time) task scheduler where I use get-scheduled task within Invoke-Command to pull information on specific tasks. On one server...

View Article


Powershell Revoke CA

HelloI have a Powershell which revokes the User and Computer CA but gives Error:Revoking "05" -- Reason: Unspecified ICertAdmin::RevokeCertificate: The parameter is incorrect. 0x80070057 (WIN32: 87...

View Article

unable to get the output of Invoke-sqlcmd while using in scriptblock

I am using a script block to run a query and perform an action depending upon the results of it. Invoke-sqlcmd doesn't seem to be working inside script block. It produces blank output, whereas i put in...

View Article

Powershell ISE Suspend Debug option stop the output

HiI have an annoying problem while using Write-Debug in ISEExample Script:for ($i = 0 ; $i -lt 10 ; $i++) { $i Write-Debug -Message "Loop" -Debug }This will output $i then "Loop" then ask you to if to...

View Article
Browsing all 21975 articles
Browse latest View live


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