New-PSSession and Connect-MSOLService require two separate logins to Office 365?

When I want to run Powershell code that interacts with Office 365, it seems that sometimes I am required to login twice. New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -AllowRedirection Connect-MSOLService What is the difference between these two commands, and why might they require two separate logins? I would think after I have logged in […]

UWP app file picker exception: Access Denied to file

I’m trying to write a simple UWP app and I’m having trouble getting the picker to open a file. I’ve basically copied exactly as seen in the MSDN docs here. When I try to open a file, I’m getting this error: System.UnauthorizedAccessException HResult=0x80070005 Message=Access to the path’ C:UsersuserDownloadsbgbtest.gb’ is denied. Source=System.IO.FileSystem I see in the […]

How to find out why your script is not working?

I have the following script: $IDs = import-csv -path “C:tempNew folderUPN_List.csv” ForEach ($ID in $IDs) { get-aduser -filter {CustomAttribute3 -like “$ID”} -Properties * | Select-Object name,samaccountname | Export-Csv -Path “C:tempNew folderString3_Names4.csv” – append } It works if I individually take the get-aduser command and replace the “$IDS” with an actual ID. I get the output […]