T-SQL Loop exits after returning 1 row
I have a t-sql query that returns many rows and runs fine within sql server. When I run it in powershell it returns the first row and exits. It appears that if I put in a select to output the results...
View ArticleSimple Convert Powershell 3.0 statement to Powershell 2.0
Hello All! I would like to convert this statment: dir *.atf -recurse Where .atf is my file extension and all I wanted to do was go to a folder and list all the contents. Thanks!
View ArticlePassing objects into functions
I'm trying to do what I thuink should be a simple thing but it's just not working. I wrote a sample function and I'm passing an object and then referencing the properties of it. But the output only...
View ArticleManipulating text with a PowerShell script
I've got a ulility that gives me text output that I read into an array of strings. The 4th word in each string is the name of the vm I need to do other operations on. How can I perform operations on...
View ArticleGet only one line from a log that have a specific word
Hi, I have a string ($myString). How can I the ONLY one line that have the word 204.94.128.8 ? $myString = " 120506 00:01:04 204.14.123.4 /focus/bsvs2a.mpg 120506 00:01:36 204.24.124.3...
View ArticleExecuting a program with elevated privilegies
Hi everybody. I'm starting to use Powershell to do some administrative tasks and i'm having a little bit of trouble with a particular script. My client needs to deploy a software, but it only have a...
View Articlemove backups files one place to another place
Hi Team, Can you please check the below script was correct or not i m planning to put 20 days backups files in local drive after then we have to move some another drive. echo off echo "Zip the Backup...
View ArticleFirst Q on test-connection - which is probably true for more
hi, I am trying to understand why the following works: $a="server1" test-connection $a AND this works: test-connection server, server2 !BUT the following does not: PS S:\systemOnly> $a="server1,...
View ArticleDNS record update via powershell
Hi all, I need to create a powershell script that will allow me to update the records of some of my dns server. In practice inserting the ip in the script, found when they come within the zone, I have...
View Articlefollow upQ on HOW to MOSt efficiently run test-connect
I noticed that if I run test-connect with a list of 25 targets and use -count1 -quiet I get all the answers together VERY fast. 1) will this scale up for 255 IPs? 2) How would this compare with using...
View Articlehow to alter this code so test-connection will work in parallel
hi I got this efficient code from Blindrood in a prev post (tnx) 1..255 | foreach { if(Test-Connection "192.168.1.$_" -count 1 -quiet) {"192.168.1.$_ ok"} else{"192.168.1.$_ not ok"} } This does pings...
View ArticleSimple get-childItem and parent folder name only
Hello all! I have files inside a main folder. In this main folder are also other subfolders with the same type of files (.atf ext). I have been able to grab all of the items in the folders and sub...
View ArticleHow to parse a Date string?
Hello together, An easy question but I couldnt manage to find an answer yet. Lets assume I export the following string to a text file: (get-date -format "yyyyMMdd") Now i try to import the string and...
View Articleset-executionPolicy configuration
Hello! If I want to run something like this without an exception occuring: if(ExecutionPolicy -ne Unrestricted){Set-ExecutionPolicy UnrestrictedY} How can I? I keep getting the error: am i suppose to...
View ArticleEnabling folder redirection for windows XP
Dear Microsoft Community, We need some assistence on how to get windows XP function in a domain environment with folder redirection. We have a domain in a mixed environment with windows XP and...
View ArticleParse a file
I am working on searching a file for Session variable values like below and put the value in a table . Session("Test") = "http://test.dll" the first step i am doing to find the line that contains the...
View Articlescript to list directories and subdirectories > nnnMB
Hy, I need help to create a script to list directories and subdirectories on a server listing directories with size larger than 500mb for example tanks Julio
View ArticleThank you to each and every one of you the contributors
I recently wrote my largest PowerShell I have done and am now on my second one. I just do little pieces as I can when time is free and I really kind of understand it. In the sense that I know basic...
View ArticleHow do I check for an empty SIDHistory attribute in a AD User?
Hello, I execute the following and I dont get any accounts with an empty SIDHistory attribute even though there are accounts with empty SIDHistory attributes. Actually, an empty SIDHistory attribute...
View ArticleProcesses watcher does not work
Hi, I found this script out on the interwebs and it looks like it will do what I want, however, It has trouble with -ne $Null. Here is the script: Function Start-MsiExec($Command) > { > While...
View Article