Test in PowerShell code if a folder is a junction point?
How can I test in PowerShell code if a folder is a junction point? ...
How can I test in PowerShell code if a folder is a junction point? ...
Hi Guys, I need a script that can gather folders/files information from large drives (600GB to 1TB). The info that I will need are: Full name/path of the file File Size Date Created Date Modified Date last accessed. So far I have the code below: dir 'e:\' -recurse | select FullName,Length,CreationTime,LastWriteTime,LastAcces...
I have a function (function1) which requires sta mode. I'd like tocall this function from a non sta mode poshconsole. This works when i have function1 in my Profile $command = "function1 'MyArguments'" powershell -sta -command $command But how can i do this when i have the function1 not in the profile and i call powershell -sta -no...
I have to sign remote scripts with a certificate from the remote machine from which I have a .pfx file. I would like to automate the scripting by supplying the password to the Get-PfxCertificate programmatically. So the question is: Is it possible to somehow supply programmatically the required password to Get-PfxCertificate? ...
I have a user management application that I've written that works great under XP but as part of our prep for moving up to Windows 7 I have been trying to get it to run under Windows 7 and my Exchange PSSnapIn is not playing nice. It always reports "No snap-ins have been registered for Windows PowerShell version 2." But I can go ru...
How do I do the equivalent in PowerShell? Note that I require the full path to each file. # ksh for f in $(find /app/foo -type f -name "*.txt" -mtime +7); do mv ${f} ${f}.old done I played around with Get-ChildItem for a bit and I am sure the answer is there someplace. ...
How can I get a list of multiple XML files from a specified directory and for each file add an element under the second root node using powershell? Example: I want to add <LastName>SomeName</LastName> within the FIRST <Names> element: <People> <Names> <FirstName>someFirstName</FirstName> </Names> <Names> <FirstName>my...
My attempts to add a(ny) PowerShell script as a BizTalk 2009 PreProcessingScript oder PostProcessingScript (Application -> Resources -> Add) are always met with an error message Validation failed for 1 resource(s). Cannot add an unsupported script type (extension = ".PS1"). Verify the source location "c:\somescripts\BtsDumpEnvironmen...
I've got a PowerShell function that's returning a list of executable names (with the file extension), and I'm trying to kill any of these if they are running, but not having much success. Here's the command I'm using: Get-Executable-Names ` | where { $_ -match ".exe" } ` | foreach { $_ -replace ".exe" } ` | foreach { ps $_ } ` | kill ...
I'm setting up git on my new Windows 7 machine and I'm hitting a roadblock when it comes to getting github to acknowledge my ssh key. I am doing things a little different from the standard script in that I would rather not use cygwin and prefer to use my powershell prompt. The following is what I did: I installed msysgit (portable). I...
I have a set of WMV files that I need to convert to H.264. I have Expression Encoder 3 and can do each through the UI. Just trying to find a script to batch it through PowerShell using the Encoder 3 SDK. Thanks ...
When hosting the PowerShell runtime is it possible to convert a PSObject back into its original type some how? For example: I have a cmdlet that calls WriteObject and pushes a collection of ClassXzy in the pipeline. When I call PowerShell.Invoke from the host end of things I retrieve a collection of PSObjects with a BaseObject propert...
I have a variable that is common to most of my app called "emails". I also want to use "emails" as the name of a parameter in one of the scripts. I need to refer to the value of both variables in the same script. Ideally there would be a way to refer using module/namespace or something and perhaps there is but I don't know it. You can se...
I'm evaluating Windows PowerShell as a replacement for cmd.exe for basic process automation for command-line code (e.g. setup, execution, and post-processing of large numbers of Fortran jobs.) I know enough perl and shell to achieve what I want but I'm trying to stay within the Windows toolchain rather than needing to train my coworkers ...
Hi everyone, in my script I check some files and would like to replace a part of their full path with another string (unc path of the corresponding share). Example: $fullpath = "D:\mydir\myfile.txt" $path = "D:\mydir" $share = "\\myserver\myshare" write-host ($fullpath -replace $path, $share) The last line gives me an error since $p...
Hi All, I am struggling to get a PowerShell script to work. I am very new to PowerShell so could be missing something stupid. $sourceuri = "ftp://ftp.mysite.com/myfolder/myfile.xml" $username = "user" $password = "password" # Create a FTPWebRequest object to handle the connection to the ftp server $ftprequest = [System.Net.FtpWebRequ...
Suppose I have a file named "test[1].txt". Both of these commands produce no output: PS C:\Temp> dir test[1].txt PS C:\Temp> get-acl test[1].txt PS C:\Temp> The good news is that the dir command has a -LiteralPath switch that tells it not to interpret any characters as wildcards: PS C:\Temp> dir -LiteralPath test[1].txt Direc...
Register-ObjectEvent looks for a object instance in the required parameter InputObject. What is the syntax for an object's static (Shared) event? UPDATE: Correct syntax for TimeChanged: $systemEvents = [Microsoft.Win32.SystemEvents] $timeChanged = Register-ObjectEvent -InputObject $systemEvents -EventName 'TimeChanged' -Action { Write-...
substring complains when I try to limit a string to 10 characters which is not 10 or more characters in length. I know I can test the length but I would like to know if there is a single cmdlet which will do what I need. PS C:\> "12345".substring(0,5) 12345 PS C:\> "12345".substring(0,10) Exception calling "Substring" with "2" argument...
Seems like this should be simple, but powershell is winning another battle with me. Simply wanting to output the name of all the services running on a system, and their executable path, and pipe that into something I can use to search through it like Less. So far I have: $services = get-WmiObject -query 'select * from win32_service...