Michael Pietroforte commented on
Use PowerShell Invoke-Command to run scripts on remote computers 3 weeks ago
Does it work if you run Invoke-Command for a single computer?
Hello. Thank you very much for the article. It is really helpful.
I wanted to ask you something. Perhaps you can help.
I have a ps1 file. A function.
I am trying to make it run against several remote computers. I am trying to use invoke-command to achieve this but it is not working.
This how I am trying to run it. Can you please tell me if this is OK or how you would run it?$VMS= get-content “D:-facundoVMS.txt”
foreach ($V in $VMS) {Invoke-Command -computername $v -FilePath D:-facundoStart-Cleanup.ps1}
Thank you for your reply ( 9 Months is not a time!). However you didn’t answer my question. Maybe you intended to answer another thread, and the text just slipped just in here.
I repeat my question: Does this all work, when execution policy is set to AllSigned per GP?
Essence is: do digitally signed PS scripts work with Ansible?Hi Brandon,
Thank you for the wonderful insight.
I run ansible playbook and used all the modules like- win_command/shell/powershell or win_mapped_drive to map and unmap . Task runs successfully but it doesn’t map/unpad the drive in the server.
Ansible ver is 2.7.7
WIn ver – 10What are all the other ways to accomplish this task.
Thank you
Carsten Ringgaard commented on
Display access rights on Active Directory OUs with PowerShell 3 weeks, 1 day ago
Set-Location AD:
David Figueroa commented on
Export and import to and from Excel with the PowerShell module ImportExcel 3 weeks, 4 days ago
Import-Excel pulls in the data as PSCustomObjects. So, just like working with PSCO’s in other contexts, when you’re grouping them, the first one determines the list of available properties. So, you should select all the properties even if they’re all blank That will force the exported sheets to have everything you need.
David F.
Mike Kanakos commented on
Export and import to and from Excel with the PowerShell module ImportExcel 3 weeks, 5 days ago
Hi Ripp…
I am not 100% sure. The author of exportExcel has a wonderful website with many examples. You can check there or ask him directly.
I found relevant pages on the web that shows some examples but didn;t work all people in all cases.
Example1:
https://github.com/dfinke/ImportExcel/issues/118Example2:
Export-Excel (from ImportExcel module) is swallowing my decimal and date points…
byu/germanyjr112 inPowerShellwhat you will see when you read those posts is essentially that the data needs to be formatting before its exported.
Mike Kanakos commented on
Export and import to and from Excel with the PowerShell module ImportExcel 3 weeks, 5 days ago
The -importcolumns parameter requires the -worksheet parameter also. Since you didn’t specify a worksheetname, it doesn’t know which tab to pull the column data from.
Sammy Morini commented on
Export and import to and from Excel with the PowerShell module ImportExcel 3 weeks, 5 days ago
If your first item in your table has attributes which have no value, those will not be added to the excel table, even if futures items have that information… meaning the excel table will only have the columns associated to what the first item had values for… any way around this, ie. force include all?
Santosh Patil commented on
PowerShell Invoke-WebRequest – Parse and scrape a web page 3 weeks, 5 days ago
Hi, If the link is hidden behind a generic link, then how can get that accurate link?
example: link resolve by invoke command:
“https://pmt.physicsandmathstutor.com/wp-content/uploads/../../download/Physics/GCSE/Notes/CIE-IGCSE/1-General-Physics/Summary Notes.pdf”and while resolving in Chrome Browser:
“https://pmt.physicsandmathstutor.com/download/Physics/GCSE/Notes/CIE-IGCSE/1-General-Physics/Summary%20Notes.pdf”Michael Pietroforte commented on
Set and remove the read-only file attribute with PowerShell 1 month ago
Brian, you are right. I corrected the text and the code. Thanks for the hint!
that first line also needs /move
robocopy /e /maxage:30 /move /r:2 /w:2 c:Source c:Destination robocopy /e /xf *.* /r:2 /w:2 C:Destination C:Source
You would need 2 passes. The first one to move the items that are 30 days or newer, and then one to restore the directory structure
probably something like:robocopy /e /maxage:30 /r:2 /w:2 c:Source c:Destination robocopy /e /xf *.* /r:2 /w:2 C:Destination C:Source
David F
Gaurang commented on
Robocopy examples 1 month ago
Hi,
Is there any option to move data from source to destination such that source will have only last 30 days data and others are moved to new destination? Keeping folder structure in Source also.Ken commented on
Setting up NuGet.Server to host your own NuGet feed (PowerShell repository) 1 month ago
This is good, but how do we query for package – version, and delete using the REST api?
What are the URL’s that we would use? I have tried a few different ways and none work yet.
http://myserver.mycompany.com/MYREPO/nuget/Packages, etc. Nothing seems to work.
Any thoughts?
Andrew Kaplan commented on
Monitoring Windows services with PowerShell 1 month, 1 week ago
Hello.
Thank-you for your response. The actual command syntax that I used is the following:
powershell.exe -executionpolicy bypass C:ScriptsGetDiskReport.ps1 -ComputerName mghromatlab1 -ServerName ‘MATLAB License Server’ -Path C:PSServicematlab.txt -FromAddress rowatchman@partners.org -ToAddress ahkaplan@partners.org -SmtpServer smtp.partners.org
When I ran the above command again, the following error messages appeared on-screen:
At C:ScriptsGetDiskReport.ps1:1 char:599
+ … ´TËnÂ0¼Wê?D¾V‰¡‡ªú8¶H¥`ì
+ ~
Missing closing ‘)’ in expression.
At C:ScriptsGetDiskReport.ps1:2 char:17
+ XõKöòúûnDUA*å)YïÌììăÑÚšl 1iïJÖ/z,’½ÒnV²ÉK~ϲ„Â)a¼ƒ’m ±Ñðúj0Ù …
+ ~
Unexpected token ‘)’ in expression or statement.
At C:ScriptsGetDiskReport.ps1:4 char:32
+ ¤×8ãAÈO1~ÛëÝqé‚Ãk6<A%³ç5}Þ*‰`Ë·k®’‰Œ–I)_:õƒ%ß1ÔÙœIsÒ
+ ~
Unexpected token '}' in expression or statement.
At C:ScriptsGetDiskReport.ps1:7 char:65
+ "ÒÙÞH¡w"ë„™ìw̤ھ½£ ºPÛ^æôçËOÖ›ƒ›Ô;§ž»vøéˆÀoñÀˆP//=+¡G*~§¨§ì’ƒ¼BYL|¡˜î¤¬&¼#‘+çXB#)׊ZÑÊ*Ö …
+ ~
Unexpected token ‘)’ in expression or statement.
At C:ScriptsGetDiskReport.ps1:15 char:404
+ … à+qp5µQÙ1Žk«›dµ¿²è³Ð²g;øµéâi¸P(mgël/yÂjŸ¸Zª{y,™«|“&awSôslI …
+ ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks (“&”) to pass it as part of a string.
Not all parse errors were reported. Correct the reported errors and try again.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : MissingEndParenthesisInExpressionDid you supply the email addresses for the -FromAddress and -ToAddress, along with the SMTPServer address (name or IP)?
Lastly, your need to make sure your sending the email to and from the correct domain for the mail server. You cannot normally send mail through a mail server for a different domain than it can receive, unless it is configured to allow your machine’s email to be relayed. If you’re trying to use a mail server external to the domain, then you need to understand what the requirements of that mail server are. Most of the time, the Send-MailMessage is not sufficient for those, and you end up needing something like MailKit or Mailosaurus to send email to those.
David F.
David Figueroa commented on
How to create an open file/folder dialog box with PowerShell 1 month, 1 week ago
You might check out this article: https://blog.netnerds.net/2016/01/showdialog-sucks-use-applicationcontexts-instead/
Chrissy (author of DBATools) recommends that people use$appContext = New-Object System.Windows.Forms.ApplicationContext [void][System.Windows.Forms.Application]::Run($appContext)
instead of ShowDialog()
That might work for you?David F.
Andrew Kaplan commented on
Monitoring Windows services with PowerShell 1 month, 1 week ago
Hello.
I am trying to get the script to operate, but without success. The command syntax that I am using is the following:
powershell -executionpolicy bypass -File C:ScriptsGet-PSServiceStatus.ps1 -ComputerName mghromatlab1 -ServiceName ‘MATLAB License Server’ -Path C:PSServicematlab.txt -FromAddress -ToAddress -SmtpServer
However, I am not receiving emails after running the script. What am I doing wrong?
- Load More