Excel 2013 SaveAs method of Workbook class failed
Hi I am using Powershell scripts to run Excel 2013 on a Windows 2012 server and save the spreadsheets as 2003 .xls workbooks. If I use the $xlNormal = 51, then the spreadsheets save correctly as .xlsx...
View ArticleReply To: Excel 2013 SaveAs method of Workbook class failed
Try setting $objExcel.DisplayAlerts to $false instead of $true. That might be causing the behavior you’re observing. For reference, here are the valid values of the XlFileFormat type: PS...
View ArticleReply To: Excel 2013 SaveAs method of Workbook class failed
Hi Dave Thanks. That appears to have sorted the problem. Regards David
View ArticleDetails of a thread in Powershell
How can I get the CPU consumption of all threads running in a process thru powershell, in a format similar to this. I can’t find any processor information when I run (gwmi win32_thread)[0] . And the...
View ArticleReply To: Details of a thread in Powershell
You’ll probably need to query performance counters for this information. Check out the Win32_PerfFormattedData_PerfProc_Thread class. It has (among other things), PercentPrivilegedTime,...
View ArticleAt a loss with Get-ChildItem behavior
Hi, I’ve been at this for a really long time and I’m at my wits end. My script is below. I’m trying to figure out why I’m not getting any objects returned from line 66 when I specify multiple filters...
View ArticleFind AD computers created on a specific date (Without using Quest)
Hi, Does anyone have a way of finding AD computers created on a specific date, without using the quest AD snapin? Currently, I use this simple little one liner… unfortunately I need to be able to do...
View ArticleReply To: At a loss with Get-ChildItem behavior
What’s in your $logName variable when it works, an when it does not? I suspect that the problem is that you’ve declared the $logName parameter as a [string], not [string[]]. When you want to pass...
View ArticleNested ForEach ?
I put together a script that searches for a user’s profile on a list of computers and removes the profile if found. It works, but now I’m trying to clean it up and break it into a function or two, add...
View ArticleReply To: Find AD computers created on a specific date (Without using Quest)
Can you use the Microsoft ActiveDirectory module, or are you limited to the System.DirectoryServices classes? Either way, there is a “whenCreated” property that you can filter on. You’ll probably need...
View ArticleReply To: Nested ForEach ?
It’s generally a good practice to save the value of $_ to some other variable at the start of your ForEach-Object loops. That way if some other piece of code reassigns $_ later, you don’t lose the...
View ArticleAdding printer from print server
Hi All, We are migrating to a new print server, and i am writing a script to detect a users installed printers, change the server name and re add the printers (and also set the default printer). This...
View ArticleReply To: Nested ForEach ?
Ahh, so if the nested ForEach are inside a function, I would pipe the output to a log file when the function is called, rather than as a part of the function… that will work great, Thanks!
View ArticleCopying Images(.JPG) to a Zip Folder prior to Sftp
$Images = Get-ChildItem -Path C:\Photos\*.jpg # i test the variable using $Source and see that the images are there. Foreach ($_. in $Source){ Copy-ImageToOrganizedFolder -Path C:\Photos2\$_.Jpg...
View ArticleReply To: Copying Images(.JPG) to a Zip Folder prior to Sftp
$_ is an automatic variable that sometimes gets assigned by the PowerShell engine. It’s kind of confusing to use it as your own variable name in something like a ForEach loop, and may cause you...
View ArticleReply To: Copying Images(.JPG) to a Zip Folder prior to Sftp
The $source is supposed to contain 6 images that were copied using the get-childitem. i am using the examples photos provided in windows 7. The Copy-imagetoarganisedfolder is part of the PS pack. i...
View ArticleReply To: Copying Images(.JPG) to a Zip Folder prior to Sftp
I’m not familiar with the Copy-ImageToOrganizedFolder command or where you’re getting it from, so I can’t help you much there. It looks like maybe you’re trying to use two different variable names for...
View ArticleReply To: Copying Images(.JPG) to a Zip Folder prior to Sftp
Both seem to work, but prompts me for Values to supply to the property… :-/
View ArticleReply To: Copying Images(.JPG) to a Zip Folder prior to Sftp
In that case, I’d need to see this Copy-ImageToOrganizedFolder command. Try running these commands, and paste the output back here: Get-Command Copy-ImageToOrganizedFolder Get-Command...
View ArticleReply To: Copying Images(.JPG) to a Zip Folder prior to Sftp
CommandType Name Definition ———– —- ———- Function Copy-ImageIntoOrganizedFolder … PS C:\Windows\System32> Get-Command Copy-ImageIntoOrganizedFolder -Syntax Copy-ImageIntoOrganizedFolder [-Path]...
View Article