compdigit44
asked on
PowerShell Send all resullts to one file
I am trying to write a simple Powershell script which I can run to query the environment and look for the presence of a directory
Here is what I am looking for as as example:
$env:COMPUTERNAME ; Test-Path c:\users ;get-date
I would like all results display on the powershell console and append to a file the with each workstation result listed on one line each
Here is what I am looking for as as example:
$env:COMPUTERNAME ; Test-Path c:\users ;get-date
I would like all results display on the powershell console and append to a file the with each workstation result listed on one line each
ASKER
Thank!!!
Now if I wanted to run this against a list of device but have it report the results to the console and file how would I do that. I would assume I would need WinRM enabled for this.
I am asking since I an inventorying a companies small network which we just took over
Now if I wanted to run this against a list of device but have it report the results to the console and file how would I do that. I would assume I would need WinRM enabled for this.
I am asking since I an inventorying a companies small network which we just took over
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks so much...
I understand the get-content is for the text file list all devices but I am confused as to the first two lines
I understand the get-content is for the text file list all devices but I am confused as to the first two lines
$Share is the share under which the path is when accessed remotely; for C:\Users, that would be the administrative share C$.
$Path is the path to test against under that share.
A simple
Test-Path "\\$_\C`$\Users"
would lead to false negatives if the machine is turned off or otherwise not accessible.
$Path is the path to test against under that share.
A simple
Test-Path "\\$_\C`$\Users"
would lead to false negatives if the machine is turned off or otherwise not accessible.
ASKER
Thanks I will test it.... WinRM is required ino rder to run this correct?
Nope; as I said, just the regular admin shares. No remoting involved.
Open in new window