Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Passing Crentials to the below script

$
0
0

Hello Friends,

Could you please help me with the below script?

Below script works great but we have multiple domains no trust so i want to pass different credentials for different domnains.

foreach ($Server in (Get-Content C:\psfiles\QAEntservers.txt)){Get-WmiObject Win32_Volume -ComputerName $Server | Where {$_.DriveLetter -eq $null} | Select @{Expression={$Server};label="ServerName"},SystemName,label,@{Expression={$_.Capacity /1Gb -as [int]};Label="Total Size(GB)"},@{Expression={($_.Capacity /1Gb -as [int]) - ($_.Freespace/ 1Gb -as [int])};Label="InUse Size (GB)"},@{Expression={$_.Freespace / 1Gb -as [int]};Label="FreeSize (GB)"},@{Expression={[math]::round(((($_.Freespace /1Gb) / ($_.Capacity / 1Gb))*100),0)};Label="FreeSpace (%)"},@{Expression={$(Get-Date -format 'd')};Label="Report Date"} | Export-csv "C:\Psfiles\getqaServerspace.csv" -NoTypeInformation}

Appreciate your help!

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles