ForEach Script Block
I am in the process of learning PowerShell and have been reading about the ForEach statement. The simple code below is based on a script that I found online, and I have been trying to modify it to...
View ArticleAccess denied error when executing the Invoke-Command
Hi, I was trying to run the following command as the user johndoe on a remote pc which I get the following error. The user johndoe is a local administrator in the MyRemoteServerCommand, Invoke-Command...
View ArticleEnter-PSSession: WinRM cannot process the request, Kerberos authentication...
Hi!I've configured PowerShell Remoting on the server using Enable-PSRemoting commandlet.But when I'm trying to connect to the server I'm constantly getting the following error:PS C:\Users\sergeyp>...
View ArticlePowershell and keytool.exe
Hi,1. I need testing if a certificate is already existing in cacerts. I tested the below commandline but got Nothing of value...$ret=start-process -FilePath "C:\Program Files...
View ArticleDo you have a PowerShell or Batch script that can remove all nodes from XML...
Hi thereDo you have a PowerShell or Batch script that can remove all nodes from XML files, except the ones specified in an array variable?Thanks so much!
View Articleneed power shell script for Windows Service based.
I am new to Powershell script. I need the script based on the following condition.1.check the windows services running or not (for example service name test).2. Stop the test service If running then...
View ArticleTrying to change trigger time for multiple task schedules
Below is the script am trying to use and i have also included the error am receiving.Someone please help me out.Just to let you know , Below is how the tasknames look on which am trying to make...
View Articlewhy this error?
$users=Get-Content H:\powershell\erp\NOERP.txt $out = 0 foreach($user in $users) { $out += (Get-ADUser -Filter * -SearchBase $user ).count } $outtxt like thisi will get this error,But I can execute by...
View ArticleHow to calculate PowerShell script hash
Hi All,We are looking for a way to sign a powershell script (the same as the Set-AuthenticodeSignature), we tried to use trail and error to try to figure out what the Set-AuthenticodeSignature cmdlet...
View ArticlePowershell and pipeline
Hello I want to know if this command can be written without the pipelines(vertical lines)?"$u=gwmi Win32_Volume|?{$_.Label -eq'_'}|select name;cd $u.name;.\d.cmd"
View ArticleHow find value in "Object Array" ?
Hi,Sorry im not a specialist PowershellI call API yammer group , and I can not extract the members value from the stats propertysample for a group :stats : @{members = 5000 ; updates = 0 ,...
View ArticleObject reference not set to the instance of an object - exception
I was trying to call a powershell script from c# using pipeline.Invoke()My powershell script uses Split-pipeline in its code. pipeline.Invoke() creates an exception Object reference not set to an...
View Articleimport csv files with same columns in variable order
I need load data from csv to SQL . Source are multiple csv files with same columns but files might have the columns in variable order . Destination is same table. I looked at...
View ArticleExport XML filename to CSV
Hello everyone,i appreciate your help. I need advice about how to export to CSV XML filename. I have folder where are stored XML files and i am selecting special values to export to CSV. When i select...
View ArticleGet the existing text between two word many files.
$folder = 'C:\Folders' $word1 = 'Street' $word2 = 'City' $filter ='*.txt' $logfile = 'C:\Result.txt' $files = Get-ChildItem -Path $folder -Recurse -Filter $filter foreach ($f in $files) { $RP =...
View Articlehelp with serial comms
Im having an issue where in i need to send commands through the serial comms port and then wait until particular response ins received. Currently i have : $VerbosePreference = "Continue" $port =...
View ArticleGet-ADUser cmdlet incompatible with port 636 ?
Hello, Is it possible to successfully run a Get-ADUser cmdlet over port 636? Or do I need to useNew-Object System.DirectoryServices.DirectoryEntry then New-Object...
View ArticleHow to initialize a Generic.List PowerShell
This is a very simple question but I spent 2 hours Googling not a single one works. $MyInList = New-Object System.Collections.Generic.List[string] $MyInlist.Add("sdf", "sdfsdf");...
View ArticleAD removal script?
Hi, I am trying to find a way to search for an AD object in powershell and delete it, So i have figure that out kind of. But what I really want to do is have the script check if the object exists first...
View ArticleUse invoke-command to query a dpm server
I had errors when trying to query my dpm server, using "invoke-command". But I can interrogate other servers, with the same method.I think it's related to some of the specifics of DPM. Your helpers,...
View Article